PC Review


Reply
Thread Tools Rate Thread

ActiveWorkbook.SaveAs in excel 2007

 
 
=?Utf-8?B?THAxMg==?=
Guest
Posts: n/a
 
      14th Aug 2007
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
 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      14th Aug 2007
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.
--


Gary

"Lp12" <(E-Mail Removed)> wrote in message
news33DC5D8-8073-4E30-8EF3-(E-Mail Removed)...
> 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


 
Reply With Quote
 
=?Utf-8?B?THAxMg==?=
Guest
Posts: n/a
 
      14th Aug 2007
Thanks Gary.
I'll give it a try

"Gary Keramidas" wrote:

> 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.
> --
>
>
> Gary
>
> "Lp12" <(E-Mail Removed)> wrote in message
> news33DC5D8-8073-4E30-8EF3-(E-Mail Removed)...
> > 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

>
>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      14th Aug 2007
See also
http://www.rondebruin.nl/saveas.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Lp12" <(E-Mail Removed)> wrote in message news33DC5D8-8073-4E30-8EF3-(E-Mail Removed)...
> 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

 
Reply With Quote
 
=?Utf-8?B?THAxMg==?=
Guest
Posts: n/a
 
      15th Aug 2007
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?

"Ron de Bruin" wrote:

> See also
> http://www.rondebruin.nl/saveas.htm
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Lp12" <(E-Mail Removed)> wrote in message news33DC5D8-8073-4E30-8EF3-(E-Mail Removed)...
> > 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

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
saveas ActiveWorkbook.SaveAs Filename:=Range("A1").Value DarrenL Microsoft Excel Programming 4 18th Apr 2009 07:54 AM
ActiveWorkbook.SaveAs Little Penny Microsoft Excel Programming 2 16th Jan 2008 02:23 AM
Problem with Excel ActiveWorkbook.SaveAs strivedi Microsoft Excel Programming 0 8th Aug 2007 08:29 PM
ActiveWorkbook.SaveAs =?Utf-8?B?ZnJhbmtz?= Microsoft Excel Programming 6 6th Aug 2007 10:04 PM
Error When using ActiveWorkBook.SaveAs in Excel Anthony Microsoft Excel Programming 2 14th Jul 2007 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:07 PM.