I am attempting to use the FileDialog
object to return a filepath of a picture on a phone (this has also caused problems with a digital camera), connected via USB.
The simplified example is:
Sub filePathFromPhone()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
If .Show = -1 Then
'this prints "Computer" instead of "Computer\XT1031\Internal storage\Pictures\Screenshots\Screenshot_2014-05-22-11-41-41.png"
Debug.Print .SelectedItems(1)
End If
End With
End Sub
This occurs when I navigate to a screenshot on the phone through the dialog and select it. I need this to do some other processing on the file (omitted from above).
The above code works correctly if I pick anything which has a named drive (ie from the C:
or D:
or network paths with \\path\to\file
). Only when I attach a device which becomes mapped via Computer\
paths does the FileDialog not return the full path.
- How can I return the full filepath from a USB device in VBA?