Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Save As to a particular file location.

I have having using a macro to "save as" to a particular file
location. For some reason it was working and now it always saves the
file to "my document". I don't know what happened. Below is the code,
with the location I want to save it at in "local". Any ideas?

Sub save()
ActiveWorkbook.SaveAs FileFormat:=51,
Filename:=Sheets("dashboard").Range("B6").Value & " Weekly Report " &
Format(Date, "mmdd"), Local:="N:\Aarons Team\TSA Core Reports"
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Save As to a particular file location.


Is FileFormat 51 an xl2007 file format? I can't find it in xl2002.
In any case, the file path should be part of the Filename.
So...
ActiveWorkbook.SaveAs FileFormat:=51, _
Filename:="N:\Aarons Team\TSA Core Reports\" & _
Sheets("dashboard").Range("B6").Value & _
" Weekly Report " & Format(Date, "mmdd")
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



wrote in message
I have having using a macro to "save as" to a particular file
location. For some reason it was working and now it always saves the
file to "my document". I don't know what happened. Below is the code,
with the location I want to save it at in "local". Any ideas?

Sub save()
ActiveWorkbook.SaveAs FileFormat:=51,
Filename:=Sheets("dashboard").Range("B6").Value & " Weekly Report " &
Format(Date, "mmdd"), Local:="N:\Aarons Team\TSA Core Reports"
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Save As to a particular file location.

Ron de Bruin has some sample code that saves as different formats:
http://www.rondebruin.nl/saveas.htm


Jim Cone wrote:


Is FileFormat 51 an xl2007 file format? I can't find it in xl2002.
In any case, the file path should be part of the Filename.
So...
ActiveWorkbook.SaveAs FileFormat:=51, _
Filename:="N:\Aarons Team\TSA Core Reports\" & _
Sheets("dashboard").Range("B6").Value & _
" Weekly Report " & Format(Date, "mmdd")
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


wrote in message
I have having using a macro to "save as" to a particular file
location. For some reason it was working and now it always saves the
file to "my document". I don't know what happened. Below is the code,
with the location I want to save it at in "local". Any ideas?

Sub save()
ActiveWorkbook.SaveAs FileFormat:=51,
Filename:=Sheets("dashboard").Range("B6").Value & " Weekly Report " &
Format(Date, "mmdd"), Local:="N:\Aarons Team\TSA Core Reports"
End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Save As to a particular file location.

Maybe:

filename:="N:\Aarons Team\TSA Core Reports\" _
& Sheets("dashboard").Range("B6").Value & " Weekly Report " _
& Format(Date, "mmdd") & ".xlsx"

I think you'll want to read about what Local does in VBA's help under .saveas.

wrote:

I have having using a macro to "save as" to a particular file
location. For some reason it was working and now it always saves the
file to "my document". I don't know what happened. Below is the code,
with the location I want to save it at in "local". Any ideas?

Sub save()
ActiveWorkbook.SaveAs FileFormat:=51,
Filename:=Sheets("dashboard").Range("B6").Value & " Weekly Report " &
Format(Date, "mmdd"), Local:="N:\Aarons Team\TSA Core Reports"
End Sub


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Save As to a particular file location.

Thanks! I just removed the two "_" dashes and your code worked. Yes,
file format 51 is 2007 format for a macro enabled workbook.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Save As to a particular file location.

The space character followed by the underscore character is the continuation
character.

That means that the line doesn't have to extend to the far right (causing you to
scroll right/left to read it).

It can make it easier to read the code when you just have to scroll up/down.

wrote:

Thanks! I just removed the two "_" dashes and your code worked. Yes,
file format 51 is 2007 format for a macro enabled workbook.


--

Dave Peterson
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
why can't i browse to a location to save a flat file willa212 Excel Discussion (Misc queries) 0 April 2nd 10 12:16 AM
Save File in Desired Location & Name Kam Excel Discussion (Misc queries) 2 December 8th 09 04:09 PM
how to save the same file in other location ravscares Excel Discussion (Misc queries) 2 July 22nd 08 03:10 PM
Existing file not defaulting to same location using "Save As" Daniel918 Excel Discussion (Misc queries) 1 June 1st 05 12:55 AM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM


All times are GMT +1. The time now is 05:24 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"