V
voip1234
I wrote some code to let me select multiple files, then organize them
in
the order I want using listboxes and finally inserting.
For the common dialog stuff I used the code kindly
provided by Jonathan West on the following thread
http://groups-beta.google.com/group/microsoft.public.word.vba.customization/msg/4f5145a2b1e13e12
Everything works according to the way it was designed to work.
Jonathan says
"If you select multiple files, the first entry in the listbox is the
folder
they were selected from, and the other entries are the names of the
selected
files. If a single file is selected, the full pathname is returned."
which is exactly what it does.
I would like it to behave the exact same way for one or multiple
files. Specifically I would like it to provide the path as the first
entry and the second as the file name even when only selecting
one file. I have looked at the common dialog code he wrote, but
cant figure out where this is an option if there actually is
one (i am new to vba). I was also told to parse the line when
it comes in as path and file name together, but I dont know how to
do this either.
I am guessing it has to be an option on the common dialog, and
I see a section that says
----------------
'put the members of the returned sFile
'string into an array. If multiselect,
'the first member is the path, and the
'remaining members are the files under
'that path selected.
ReDim vFileList(0)
iFileTotal = 0
Do While Len(buff) > 3
ReDim Preserve vFileList(iFileTotal)
vFileList(iFileTotal) = StripDelimitedItem(buff, vbNullChar)
iFileTotal = iFileTotal + 1
Loop
FileOpenDialog = vFileList
Else
FileOpenDialog = ""
End If
End Function
Private Function StripDelimitedItem(startStrg As String, _
delimiter As String) As String
----------------
which i guess is where the secret is....but can somebody
help me figure out what to change...i want path on first
entry and filename on the following listbox entries whether it was
multiselection or not.
thanks!!!!
in
the order I want using listboxes and finally inserting.
For the common dialog stuff I used the code kindly
provided by Jonathan West on the following thread
http://groups-beta.google.com/group/microsoft.public.word.vba.customization/msg/4f5145a2b1e13e12
Everything works according to the way it was designed to work.
Jonathan says
"If you select multiple files, the first entry in the listbox is the
folder
they were selected from, and the other entries are the names of the
selected
files. If a single file is selected, the full pathname is returned."
which is exactly what it does.
I would like it to behave the exact same way for one or multiple
files. Specifically I would like it to provide the path as the first
entry and the second as the file name even when only selecting
one file. I have looked at the common dialog code he wrote, but
cant figure out where this is an option if there actually is
one (i am new to vba). I was also told to parse the line when
it comes in as path and file name together, but I dont know how to
do this either.
I am guessing it has to be an option on the common dialog, and
I see a section that says
----------------
'put the members of the returned sFile
'string into an array. If multiselect,
'the first member is the path, and the
'remaining members are the files under
'that path selected.
ReDim vFileList(0)
iFileTotal = 0
Do While Len(buff) > 3
ReDim Preserve vFileList(iFileTotal)
vFileList(iFileTotal) = StripDelimitedItem(buff, vbNullChar)
iFileTotal = iFileTotal + 1
Loop
FileOpenDialog = vFileList
Else
FileOpenDialog = ""
End If
End Function
Private Function StripDelimitedItem(startStrg As String, _
delimiter As String) As String
----------------
which i guess is where the secret is....but can somebody
help me figure out what to change...i want path on first
entry and filename on the following listbox entries whether it was
multiselection or not.
thanks!!!!