ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs CSV problem (https://www.excelbanter.com/excel-programming/331947-saveas-csv-problem.html)

pittur

SaveAs CSV problem
 

I'm using a simple Macro to save a workbook as CSV but the file is neve
saved. The code runs fine but nothing happens

Sheet2.SaveAs "C:\oko", xlCSV

I have tried different version of this code but nope.

I'm using Office XP and the funny thing is that this seems to run fin
on Office 2002.

Pittur

--
pittu
-----------------------------------------------------------------------
pittur's Profile: http://www.excelforum.com/member.php...fo&userid=2436
View this thread: http://www.excelforum.com/showthread.php?threadid=37960


keepITcool

SaveAs CSV problem
 

I see there appears to be a difference between xlXP and xl2003
to the SaveAs methods applied to a sheet.

Following seems to work in both however:

(note the use of LOCAL requires xl2002 and above)
note Local should also be specified when opening
the CSV.
UI will open local =true by default.
VBA will open local=false by default

I DO specify a csv file extension..
if not the funny thing is that
Sheet2.SaveAs "c:\ok", , xlCSV, local:=False

will popup a warning if ok.XLS !!!
exists in that location

Sub SaveAsCSV()
Dim sName
sName = ThisWorkbook.FullName
Sheet2.SaveAs "c:\ok.csv", , xlCSV, local:=False
ThisWorkbook.SaveAs sName, xlWorkbookNormal

End Sub


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


pittur wrote :


I'm using a simple Macro to save a workbook as CSV but the file is
never saved. The code runs fine but nothing happens

Sheet2.SaveAs "C:\oko", xlCSV

I have tried different version of this code but nope.

I'm using Office XP and the funny thing is that this seems to run fine
on Office 2002.

Pittur.


Dave Peterson[_5_]

SaveAs CSV problem
 
Maybe you could just copy that sheet to a new workbook, then save it there and
finally close that new workbook:

sheet2.copy
activeworkbook.saveas "C:\oko", xlCSV
activeworkbook.close savechanges:=false



pittur wrote:

I'm using a simple Macro to save a workbook as CSV but the file is never
saved. The code runs fine but nothing happens

Sheet2.SaveAs "C:\oko", xlCSV

I have tried different version of this code but nope.

I'm using Office XP and the funny thing is that this seems to run fine
on Office 2002.

Pittur.

--
pittur
------------------------------------------------------------------------
pittur's Profile: http://www.excelforum.com/member.php...o&userid=24363
View this thread: http://www.excelforum.com/showthread...hreadid=379603


--

Dave Peterson


All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com