VBA - Startpoint for allowing a user to pick a path

SarahLinn

New Member
Joined
Jun 24, 2011
Messages
1
I am currently using the code below to allow a user to select the path to save a copy on the file.

folderpath = GetFilePathandName("Please select folder for finalized workbook.", False)
If folderpath = "" Then GoTo Cancel_Routine

However I would like to set the startpoint for the user. So they can be lead in the direction I would like them to save the file. Does anyone know how to do this?

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the board Sarah Linn

You would have to change the current directory using the ChDir function.

The below code changes it just for when you need and then changes it back.

Code:
'// Get original path
preRunDir = CurDir
'// Change dir to desired path
ChDir ("C:\Start\Point")

'// CODE
folderpath = GetFilePathandName("Please select folder for finalized workbook.", False)
If folderpath = "" Then GoTo Cancel_Routine

'// Reset Dir to prechange path
ChDir (preRunDir)
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,877
Members
452,949
Latest member
Dupuhini

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