Get path to file (e.g. picture) in android device (e.g. cell phone, tablet...) (1 Viewer)

MBMSOFT

Registered User.
Local time
Today, 10:28
Joined
Jan 29, 2010
Messages
90
I need to get path string to android device or its sd card as be able to copy or get some files(e.g. pictures) to process further....
As I red around not so menu samples about ...
1. I tried go get the file with file dialog "f = Application.FileDialog..." but the directory has not been showed in the dialog
2. I follow some samples to get "getExternalFilesDir(.. " but i get "sub or function not defined" error massage
simply i need to get file from let say this address :
"Computer\HUAWEI M2-801L\Internal storage\DCIM\Camera\12.jpg"
3. I tried to use environ() go get external dir but i didn't success to open folder

As well i need to count items there or choose the latest record etc in that dir etc.
I tried to work with WIA COMMON DIALOG but I stuck over there as well

please anyone to help
 
Last edited:

nhorton79

Registered User.
Local time
Today, 21:28
Joined
Aug 17, 2015
Messages
147
I may be proven wrong but I don’t think you can access your Android or iPhone storage as they aren’t mounted volumes.
Or at least if you can you might have to write something outside of VBA and reference through Shell.

I did a quick search and found this on SO, which might assist with your question:

https://stackoverflow.com/questions...erencing-windows-portable-device-files-in-vba


Sent from my iPhone using Tapatalk
 

MBMSOFT

Registered User.
Local time
Today, 10:28
Joined
Jan 29, 2010
Messages
90
I may be proven wrong but I don’t think you can access your Android or iPhone storage as they aren’t mounted volumes.
Or at least if you can you might have to write something outside of VBA and reference through Shell.

I did a quick search and found this on SO, which might assist with your question:

https://stackoverflow.com/questions...erencing-windows-portable-device-files-in-vba


Sent from my iPhone using Tapatalk


that link could be some start, it works but for the printers..
Set objFolder = objShellAPP.Namespace("::{2227a280-3aea-1069-a2de-08002b30309d}") ' Printers and Faxes
but i cant find arguments or value for external storage
 

nhorton79

Registered User.
Local time
Today, 21:28
Joined
Aug 17, 2015
Messages
147
Did you look at the three links he provided. The first one provides a heap of namespaces and one of them is portable devices:


shell:::{35786D3C-B075-49B9-88DD-029876E11C01} - Portable Devices

That may work, have a look through them and there might be others.


Sent from my iPhone using Tapatalk
 

MBMSOFT

Registered User.
Local time
Today, 10:28
Joined
Jan 29, 2010
Messages
90
Did you look at the three links he provided. The first one provides a heap of namespaces and one of them is portable devices:


shell:::{35786D3C-B075-49B9-88DD-029876E11C01} - Portable Devices

That may work, have a look through them and there might be others.


Sent from my iPhone using Tapatalk

this give me some hope ... step by step...
Portable device does not work
but i choose computer
shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
so i did:
Code:
sub test()
    Dim objShellAPP
    Set objShellAPP = CreateObject("Shell.Application")
    COMPUTER = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    Set objFolder = objShellAPP.NameSpace(COMPUTER)
         Debug.Print "CLSID:" & vbCrLf & objFolder.Self.Path & vbCrLf
         Debug.Print "Folder name: " & vbCrLf & objFolder.Self.Name & vbCrLf
    For Each objItem In objFolder.Items()
         Debug.Print objItem.Name
         Debug.Print objItem.Path
    Next
    Set objFolder = Nothing
    Set objShellAPP = Nothing
end sub
and i got the address of the device
HUAWEI M2-801L
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_12d1&pid_1082&mi_00#6&15652f25&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
the file is stored in
HUAWEI M2-801L\internal storage\DCIM\CAMERA\12.JPG
and I'm trying to open file now
But I'm not shore how
 
Last edited:

MBMSOFT

Registered User.
Local time
Today, 10:28
Joined
Jan 29, 2010
Messages
90
So finally i did open the file with
Code:
device = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_12d1&pid_1082&mi_00#6&15652f25&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}"
Call CreateObject("Shell.Application").ShellExecute(device & "\Internal storage\DCIM\CAMERA\12.jpg")

WOW I GOT IT ....But should be easier or another way to have approach to android storage...
if someone has another ideas please help...
any way... I'm going to get some practical use of this matter and i will write down here
thanks to nhorton79 for this help
 

nhorton79

Registered User.
Local time
Today, 21:28
Joined
Aug 17, 2015
Messages
147
Wow! Awesome. Glad to hear you got it going.


Sent from my iPhone using Tapatalk
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:28
Joined
Sep 21, 2011
Messages
14,217
I think it depends on how you connect your device.

I select USB file transfer and then the VBA file dialog works as normal?
 

Users who are viewing this thread

Top Bottom