Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Multiple Files in Windows Exlorer 2

Status
Not open for further replies.

KenWK

Programmer
May 25, 2001
76
US
Hey guys, I know this works open an Windows Explorer and select the 20070806_070605-1 - Copy - Copy.JPG file:

Code:
Shell "explorer.exe /n,/e,/select," & "\\K90ANAS\Public\Family\!NewStuff\PicsFromBeth\Krugh Pics\Monadnock 2007\2007_08_06\20070806_070605-1 - Copy - Copy.JPG"

What I want to do though is select multiple files in the folder I'm opening. Media player does this so I'm guessing its possible from VBA, even if it requires an api.

Thanks for the help!
Ken
 
What application are you working in?

Do you actually want to shell to explorer and select files, or do you want the user to select multiple files which your program will then use? If the former then why?

If what you actually want to do is the latter, and if you are. for example, working in Excel, then look up Application.GetOpenFilename in the help. Ensure you have multiselect:=true.

Tony
 
Yes, I want to actually open an Explorer window with the files selected.

I have a dialog box written in VBA that assists me in reviewing my digital photos and creating low-res images with comments that I can then send to relatives.

I was hoping to add to that dialog the ability to update the jpg tags at the same time, while I was reviewing the photos for the first time. But, I've been unable to find anything that I trust and can use in VBA to update the jpg Exif data and wanted to use Windows Explorer (in Vista and/or Windows 7) to do so.

On my dialog I'd be able to select all the files that need the same tags and select the tags from my list. The software would then copy those tags to the clipboard and shell to the explorer with the files selected, at which time I could paste the tags into the Explorer.

Thanks for having taken the time to answer.

Ken
 
I THINK I may have investigated this before, but I'll have a nother look.

Thanks!
 
Ken,

I know strongm has posted loads of stuff on using GDI+, both on this forum and in the VB5/6 forum.

Given that he is a certified genius (I'd be prepared to sign the certificate if anyone wants to argue) I'd recommend you browse through a few of his posts on the topic if you have any probs.

Tony

 
> select multiple files in the folder I'm opening. Media player does this so I'm guessing its possible from VBA

It certainly is
 
Care to give any hints strongm? :eek:)

Nighteyes also mentioned browsing some of your posts regarding EXIF data in jpg files. I likely won't get to that until the weekend so I'll be lazy and ask if there is anything in particular that might be most helpful.

Ideally I'd love to read and write the EXIF data, including the tags that have general info, reliably from VBA. I've tried a couple of things I've downloaded from the internet, one of which failed if the image was rotated as well for other reasons I wasn't able to discern.

The best thing I've found since I started this post was the Microsoft WIA tool with which I've been able to at least read the date digitized. I think its main purpose in to interface with attached devices. I didn't readily see a way to update the EXIF tags but I'll be exploring that further as soon as I can find the time.


Thanks for any info you can pass along.

All the best and thanks!
Ken
 
> any hints

Sure.

You need to add a reference to Microsoft Shell Controls and Automation and to Microsoft Internet Controls.

Then have a play with this code example:
Code:
[blue]Option Explicit

Public Sub Example()
    ChooseSome "D:\test" ' obviously change this for your folder
End Sub

Public Sub ChooseSome(strFolder As String)
    Dim test As WebBrowser
    Dim myExplorer As Shell32.Shell
    
    Set myExplorer = New Shell32.Shell
    myExplorer.Open strFolder
   
    Do ' Lazy way of waiting for the correct Explorer window to open
        Set test = FindExplorerWindow(strFolder)
    Loop Until Not test Is Nothing

    ' Select a couple of items - again, your stuff would go here
    Call test.document.SelectItem(strFolder & "\mike.vbs", 5&) ' 5 ensures any previous selections are unselected
    Call test.document.SelectItem(strFolder & "\New Text Document.txt", 1&)

End Sub

Public Function FindExplorerWindow(strFolder As String) As WebBrowser
    Dim myExplorer As New Shell32.Shell
    Dim Window As WebBrowser

    For Each Window In myExplorer.Windows
        If Window.Name = "Windows Explorer" Then
            If LCase(Window.document.Folder.Self.Path) = LCase(strFolder) Then
                Set FindExplorerWindow = Window
            End If
        End If
    Next

End Function[/blue]
 
Wow, thanks!! This'll be great if I can't find anything with which to update the EXIF tags directly from VBA.

Thanks again,
Ken
 
Last time I 'round this barn I came across that but hadn't been able to make it work. I'll have a look again. In the mean time your solution for selecting multiple things in the Explorer so I can update them using Windows 7 looks like it will work pretty easily.

Thanks yet again,
Ken
 
strongm, have you ever used the GDI Wrapper in VB. I'm able to read the ImageDescription tag but I can't figure out how to SET it.

It looks like I have to use the SetPropertyItem, which according to the web site "Adds or updates a property item using the property item details passed in with the GDIPPropertyItem tag."

My problem is that I don't understand how to create the GDIPPropertyItem to pass to the SetPropertyItem.

Any help would be appreciated.

Thanks,
Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top