Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
range.offset generates a Run Time error 1004 [email protected] Excel Programming 1 August 22nd 06 05:47 PM
Runtime error 1004/ Save As method help [email protected] Excel Programming 1 August 17th 06 04:56 AM
error 1004 Method SaveAs of Workbook failed Maury Markowitz Excel Programming 2 October 25th 05 08:45 PM
ASP & EXCEL2003 - RUN-TIME ERROR 1004 in Export method Mau[_3_] Excel Programming 0 September 12th 05 09:23 AM
Runtime error 1004 with method OpenText - but only on one computer Kew[_2_] Excel Programming 0 August 30th 04 11:52 PM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"