Avatar of wlwestrom
wlwestrom

asked on 

How to copy a file from a storage device NOT drive letter through VBA

I am trying to copy a file from a storage device to a folder on my c:.  The devices comes up in Explorer like "Computer\Nexus 7\Internal storage" with no drive letter.  Also if I create a batch file to copy the file over from that location this particular file is hidden in DOS but i can see it in Explorer, R Click copy and paste fine.  

Ultimately I would like the user to be able to browse for the location and file and store the path but since it isnt a drive this isnt working.

Private Function BrowseforFile(szDialogTitle As String) As String
On Error GoTo BrowseforFile_Err

   With Application.FileDialog(3)   '4=msoFileDialogFolderPicker
   
        '.InitialFileName = Me.pastdirectory
        If .Show Then Debug.Print .SelectedItems(1)
       

        BrowseforFile = Nz(.SelectedItems(1), "Computer\Nexus 7\Internal storage")
       

    End With

BrowseforFile_RESUME:
    'BrowseforFile = .SelectedItems(1)
    Exit Function

BrowseforFile_Err_Exit:
   
    Exit Function

BrowseforFile_Err:
    Resume BrowseforFile_RESUME
End Function

I have tried all the various file dialog options to return location and/or file name.  Then i will need to be able to copy the file to a set location.

Any ideas?
Microsoft Access

Avatar of undefined
Last Comment
Jez Walters
Avatar of Jez Walters
Jez Walters
Flag of United Kingdom of Great Britain and Northern Ireland image

Apologies if this is obvious, but have you tried using a UNC path name, of the form \\<file server>\<file share>\<folder>\<file name> instead?
ASKER CERTIFIED SOLUTION
Avatar of Jez Walters
Jez Walters
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo