Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Saving a workbook to a specific directory

Hello,

Could someone please help amend my macro code so that when it is run,
the SaveAs window pops up and automatically selects the desired
directory location in my macro?

Sub Save_to_Dir()
'
'Save to Dir
'

Dim MyPath As String


Application.ScreenUpdating = False


MyPath = "G:\WLMAEWCSPO\LMU\LOGISTICS PREPAREDNESS SYSTEMS\LOGISTICS
SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE DEMAND REQUESTS\"

MyPath = Application.GetSaveAsFilename


End Sub

Any help would be greatly appreciated.

Kind regards,

Chris.



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Saving a workbook to a specific directory

Change this line:

MyPath = Application.GetSaveAsFilename

to this:

MyPath = Application.GetSaveAsFilename(MyPath)

"Chris Hankin" wrote in message
...
Hello,

Could someone please help amend my macro code so that when it is run,
the SaveAs window pops up and automatically selects the desired
directory location in my macro?

Sub Save_to_Dir()
'
'Save to Dir
'

Dim MyPath As String


Application.ScreenUpdating = False


MyPath = "G:\WLMAEWCSPO\LMU\LOGISTICS PREPAREDNESS SYSTEMS\LOGISTICS
SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE DEMAND REQUESTS\"

MyPath = Application.GetSaveAsFilename


End Sub

Any help would be greatly appreciated.

Kind regards,

Chris.



*** Sent via Developersdex http://www.developersdex.com ***




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Saving a workbook to a specific directory


Thanks Vergel for your help.

I am still having difficulty saving my workbook to the desired directory
location. I changed the macro code to:

Sub Save_to_Dir()
'
'Save to Dir
'

Dim MyPath As String


Application.ScreenUpdating = False


MyPath = "G:\WLMAEWCSPO\LMU\LOGISTICS PREPAREDNESS SYSTEMS\LOGISTICS
SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE DEMAND REQUESTS\"

MyPath = Application.GetSaveAsFilename("G:\WLMAEWCSPO\LMU\L OGISTICS
PREPAREDNESS SYSTEMS\LOGISTICS SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE
DEMAND REQUESTS\AEWCSPO Online Demand Request")

End Sub

Could you please review the changed macro code and advise where I am
going wrong?

Kind regards,

Chris.


*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Saving a workbook to a specific directory

Chris,

The call to GetSaveAsFilename will only display the "Save As" dialog and
allow you to get a filename from the user. It will not save the file.. To
do the save as, you can add these lines of code after the call to
GetSaveAsFilename

If MyPath < "False" Then
ThisWorkbook.SaveAs MyPath
End If

Or, if you want to save the current active workbook, you can use

If MyPath < "False" Then
ActiveWorkbook.SaveAs MyPath
End If




"Chris Hankin" wrote in message
...

Thanks Vergel for your help.

I am still having difficulty saving my workbook to the desired directory
location. I changed the macro code to:

Sub Save_to_Dir()
'
'Save to Dir
'

Dim MyPath As String


Application.ScreenUpdating = False


MyPath = "G:\WLMAEWCSPO\LMU\LOGISTICS PREPAREDNESS SYSTEMS\LOGISTICS
SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE DEMAND REQUESTS\"

MyPath = Application.GetSaveAsFilename("G:\WLMAEWCSPO\LMU\L OGISTICS
PREPAREDNESS SYSTEMS\LOGISTICS SYSTEMS\LOGSYS3\LOCAL PURCHASE\ON-LINE
DEMAND REQUESTS\AEWCSPO Online Demand Request")

End Sub

Could you please review the changed macro code and advise where I am
going wrong?

Kind regards,

Chris.


*** Sent via Developersdex http://www.developersdex.com ***




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Saving a workbook to a specific directory

Thanks again Vergel,

I used the following code to fix my macro. It now works great.

If MyPath < "False" Then
ActiveWorkbook.SaveAs MyPath
End If

Cheers,

Chris.



*** Sent via Developersdex http://www.developersdex.com ***
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
Saving xls in specific directory David Hodgson Excel Programming 4 November 8th 06 10:21 AM
Saving file to specific directory sungen99[_75_] Excel Programming 1 February 22nd 06 02:01 PM
Saving into new directory Greg B Excel Discussion (Misc queries) 2 March 2nd 05 03:58 PM
Saving to same directory Michael Beckinsale Excel Programming 1 December 12th 03 07:31 PM
Saving one specific worksheet in a workbook budenba Excel Programming 2 October 31st 03 12:31 PM


All times are GMT +1. The time now is 12:27 AM.

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"