ActiveWorkbook.SaveAs in excel 2007

G

Guest

Hi All,
I've have a code that saves a workbook with one sheet to a CSV file.
In 2003 edition there is no problems.
In 2007 I get the 1004 in: ActiveWorkbook.SaveAs Filename:=fname,
FileFormat:=xlCSV, CreateBackup:=False. where fname is Variant.
I've tried changing the code to: ActiveWorkbook.SaveAs Filename:=fname,
FileFormat:=6, CreateBackup:=False but still same thing.
I've scanned this forum but no answer did helped yet.
Any thoughts?
Thanks a lot inadvance
 
G

Gary Keramidas

recording a macro shows this:

ActiveWorkbook.SaveAs Filename:= _
"N:\My Documents\Excel\BP\Blending\BLENDING SCHEDULE9.csv",
FileFormat:=xlCSV _
, CreateBackup:=False

have you tried fname as a string? can you break the code and see the
contents of fname, or do a debug.print after the variable is set?

you could always test for the version

if Application.Version =12.0 then
'execute office 2007 code
else
'execute office 2003 code
end if


probably need to show your code with the variables and path info.
 
G

Guest

Thanks Gary.
I'll give it a try

Gary Keramidas said:
recording a macro shows this:

ActiveWorkbook.SaveAs Filename:= _
"N:\My Documents\Excel\BP\Blending\BLENDING SCHEDULE9.csv",
FileFormat:=xlCSV _
, CreateBackup:=False

have you tried fname as a string? can you break the code and see the
contents of fname, or do a debug.print after the variable is set?

you could always test for the version

if Application.Version =12.0 then
'execute office 2007 code
else
'execute office 2003 code
end if


probably need to show your code with the variables and path info.
 
G

Guest

Thanks Ron.
Something very strange, When I hit the macro from ecxel, it's working. When
running in debug mode, I'm ending with 1004 error.
Strange,hah?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top