Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to specify save PATH in macro?

Hi, heres the code i have so far, I have tried many different methods to
specify a save path, but the dialog box keeps defaulting to "c:\my Documents".
Any help would greatly be appreciated.

*************

Sub CustomSaveAs()

Dim res As Variant, sName As String
With Worksheets("SA009_Prepsheet")
sName = .Range("G4").Text & " - " & .Range("C13").Text
End With
res = Application.GetSaveAsFilename(InitialFileName:=sNa me,
fileFilter:="Excel Workbook Files (*.xls), *.xls")
If res = False Then Exit Sub
ActiveWorkbook.SaveAs Filename:=res

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to specify save PATH in macro?

First this


Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = "C:\Data\"
ChDrive MyPath
ChDir MyPath



Then you code




Then set it back


ChDrive SaveDriveDir
ChDir SaveDriveDir




--

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


"Ch33baman2" wrote in message ...
Hi, heres the code i have so far, I have tried many different methods to
specify a save path, but the dialog box keeps defaulting to "c:\my Documents".
Any help would greatly be appreciated.

*************

Sub CustomSaveAs()

Dim res As Variant, sName As String
With Worksheets("SA009_Prepsheet")
sName = .Range("G4").Text & " - " & .Range("C13").Text
End With
res = Application.GetSaveAsFilename(InitialFileName:=sNa me,
fileFilter:="Excel Workbook Files (*.xls), *.xls")
If res = False Then Exit Sub
ActiveWorkbook.SaveAs Filename:=res

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to specify save PATH in macro?

Thanks Ron. All i really needed was ChDir "c:\savedir", but i never inserted
it near enough to the top of the script, and therfore i never worked. I
inserted as the first line & bingo. Thanks tons.


"Ron de Bruin" wrote:

First this


Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = "C:\Data\"
ChDrive MyPath
ChDir MyPath



Then you code




Then set it back


ChDrive SaveDriveDir
ChDir SaveDriveDir




--

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


"Ch33baman2" wrote in message ...
Hi, heres the code i have so far, I have tried many different methods to
specify a save path, but the dialog box keeps defaulting to "c:\my Documents".
Any help would greatly be appreciated.

*************

Sub CustomSaveAs()

Dim res As Variant, sName As String
With Worksheets("SA009_Prepsheet")
sName = .Range("G4").Text & " - " & .Range("C13").Text
End With
res = Application.GetSaveAsFilename(InitialFileName:=sNa me,
fileFilter:="Excel Workbook Files (*.xls), *.xls")
If res = False Then Exit Sub
ActiveWorkbook.SaveAs Filename:=res

End Sub


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
Macro to create a path and save a workbook in it Gaura215 Excel Discussion (Misc queries) 1 February 4th 11 12:36 PM
Save as cell with path Curben Excel Programming 2 June 29th 06 01:39 PM
Macro to create "path" for save Chris Excel Discussion (Misc queries) 4 March 15th 06 10:38 AM
Want to Set the File Save As path Brenda Excel Programming 1 February 24th 06 03:45 AM
save as path kevin Excel Discussion (Misc queries) 1 February 15th 05 12:40 PM


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