Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save as method generates 1004 error
Hi All,
Im using Vista/Excel 2007 on domain. I wrote a VBA code that save a xls file to csv. When I get to the line: ActiveWorkbook.SaveAs Filename:=fname, FileFormat:=6, CreateBackup:=False it generate the 1004 error. I've tried running the code in a local XP (not domain) and it worked perfect. Any suggestions? Thanks a lot in advance. Here is the entire code: Sub CreateCSV() On Error GoTo ErrorHandler fname = "C:/One/Two" Application.ScreenUpdating = False ADPDir = Dir("C:\One\", vbDirectory) If ADPDir < "." Then MkDir "C:\One" If Len(Dir("C:\One\Two", vbDirectory)) = 0 Then MkDir "C:\One\Two" End If End If wbname = ActiveWorkbook.Name Windows(wbname).Activate shname = ActiveSheet.Name Sheets(shname).Select Range("A2:AC2").Select Selection.Copy Workbooks.Add Range("A1").Select ActiveSheet.Paste Application.DisplayAlerts = False Sheets("Sheet2").Delete Sheets("Sheet3").Delete ActiveWorkbook.SaveAs Filename:=fname, FileFormat:=6, CreateBackup:=False |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
range.offset generates a Run Time error 1004 | Excel Programming | |||
Runtime error 1004/ Save As method help | Excel Programming | |||
error 1004 Method SaveAs of Workbook failed | Excel Programming | |||
ASP & EXCEL2003 - RUN-TIME ERROR 1004 in Export method | Excel Programming | |||
Runtime error 1004 with method OpenText - but only on one computer | Excel Programming |