Need dialog to get path from user.

OaklandJim

Well-known Member
Joined
Nov 29, 2018
Messages
833
Office Version
  1. 365
Platform
  1. Windows
Need to get full path from user. Tried both msoFileDialogSaveAs and msoFileDialogFolderPicker with .FileDialog.

Unless I missed something msoFileDialogFolderPicker returns a folder then I need to figgger out rest of path? I guess I could parse all dirs and find the folder name but what about dups in other paths?

I may be misusing msoFileDialogSaveAs but it adds .xls to the default path I specify. Makes sense if trying to save a file not a path...stating the obvious I guess. But that is not helpful. Can I specify a path only for that? I did try with .InitialFileName = ThisWorkbook.path but Excel adds that .xls extension to what user sees.

Do you see a path forward for me to address this need.

Jim
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
This will return the full path
VBA Code:
   With Application.FileDialog(4)
      If .Show = -1 Then MsgBox .SelectedItems(1)
   End With
 
Upvote 0
Fluff Thankx a lot for responding! I tried it. It shows the ONLY the folder of the workbook from which the sub is called. (Oddly the folder name is skewed left so it is not fully visible in the dialog when it shows.) Logical. But if I say OK Excel gives dialog titled "Browse" and it tells me that the path does not exists. Of course it does. If I select a DIFFERENT folder then navigate back to the same folder it works. Same problem as msoFileDialogFolderPicker. What am I missing?

The path to Excel is a rocky one sometimes.
 
Upvote 0
It shows the ONLY the folder of the workbook from which the sub is called
Beg to differ, it shows the fullpath to the folder that's selected.
Did you change the code at all, or did you try exactly what I supplied?

PS that is the MSOFileFolderPicker, I'm just lazy & can't be bothered to type the whole thing out ;)
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,548
Members
449,038
Latest member
Guest1337

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