View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default 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.