Can I make my Save as Dialoge box pop up with Documents as location?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,

We have a document that is saved in a sharepoint.

I want to make saving a copy easy for others but also give them the choice of where they save the document.
so I created a save button and when click it runs this code:

Code:
Sub filesave()
    Dim bFileSaveAs As Boolean
    bFileSaveAs = Application.Dialogs(xlDialogSaveAs).Show
    If Not bFileSaveAs Then MsgBox "User cancelled", vbCritical
End Sub
which works but defults the save as location to the sharepoint area, I want them to save it to their computer so the ideal defult would be the documents folder
any ideas how I can edit my code (or get a different code) that when the save as box pops up it is defaulted to the documents folder??

Thank

Tony
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Tony

If you use GetSaveAsFilename you can use ChDrive and ChDir to change the current folder and when the dialog appears that will be the folder in view.
Code:
Dim bFileSaveAs As Boolean
    
    ChDrive "C:\"
    ChDir "C:\Test"
    
    bFileSaveAs = Application.GetSaveAsFilename
    
    
    If Not bFileSaveAs Then MsgBox "User cancelled", vbCritical
 
Upvote 0
Code:
Thanks Norie,
just one small edit and worked great. big big help thank you :-)
the code i used:

Code:
Sub save1()
Dim bFileSaveAs As Boolean
    
    ChDrive "C:\"
    'ChDir "C:\Test"
    ChDir Environ("USERPROFILE") & "\Desktop\"
    bFileSaveAs = Application.GetSaveAsFilename
    If Not bFileSaveAs Then MsgBox "User cancelled", vbCritical

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top