View Single Post
 
Old 07-14-2014, 12:29 AM
smndnm smndnm is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Jul 2014
Location: Queensland
Posts: 24
smndnm is on a distinguished road
Default refering to the msoFileDialogueOpen variants

Hello,

How does one refer to the files selected by this code?

Code:
 
  Dim dlgOpen As FileDialog
 Set dlgOpen = Application.FileDialog( _
 FileDialogType:=msoFileDialogOpen)
 With dlgOpen
 .AllowMultiSelect = True
 .Show
 End With
I can count them with:
Code:
dlgOpen.SelectedItems.Count
But I am not understanding how to reference them and thus specifically process them (given that these will change at each running of the macro)
The intention is:
open and update doc1, click the "update all other docs" button.
This button saves doc1, opens the dialogue to multiselect the other required docs and then invokes a loop(?) to run through an "update-saveas" process on those docs.

I am going guess at:

Code:
Dim i As Integer
Dim "dlgopen.SelectedItems" as Variant
For i = 1 to dlgOpen.SelectedItems.Count
' Open Variant, Update links, Save As, Close
Next i
I think I can do the open, save-as and close (I have a working macro for this), but the question is:
How do I refer to each file selected so as to be able to process them?

Many Thanks from Queensland.
Reply With Quote