![]() |
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 |
All times are GMT +1. The time now is 12:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com