1

I have a function that I use to select a folder

Function GetFolderDialog() As String
  Dim fd As Office.FileDialog

  Set fd = Application.FileDialog(msoFileDialogFolderPicker)
  With fd
    .Title = "Select a Folder"
    .AllowMultiSelect = False
    .InitialFileName = Application.DefaultFilePath
    If .Show = True Then
        GetFolderDialog = .SelectedItems(1)
    End If
  End With
End Function

Which works fine, however I have a mapped drive (z drive) to a shared onedrive location And when I select that folder with this function instead of returning

z:\my folder location

it returns

https://d.docs.live.net/xxxxxxx/my folder location

I've found some questions that look at replacing the url (such as VBA Document.Path returns Web path when in OneDrive - Need local path)

That doesnt quite fit my needs though, I basically want the dialog to return z:\my folder location

instead of the full url (the other pages I've found seem to replace the url with a local c drive\ one drive path)

braX
  • 11,506
  • 5
  • 20
  • 33
Michael Liew
  • 273
  • 3
  • 12

0 Answers0