File Open Dialog

S

scantor145

Visual basic 6.0 w/Excel 2000

Below is a section of code I use to open up a specified number o
files.


Code
-------------------
For N = 1 To NumFiles

FilterList = "Text Files(*.txt),*.txt"

With Application
MyFile(N) = .GetOpenFilename(filefilter:=FilterList)
End With

Next
-------------------


99.9% of the time the files in the File Open dialog box are listed i
the order in which I select them. When the File Open dialog box open
for the first time, and every time after that, the first file in th
list is always highlighted. Is there a way to have to have VB6 move th
highlight down a file(s) after each File Open execution
 
D

Dave Peterson

You might be able to do something with sendkeys, but I would think that would be
close to disasterous!

Maybe you could just select all the files you want with one File|open:

Option Explicit
Sub testme2()

Dim myFileNames As Variant
Dim iCtr As Long

myFileNames = Application.GetOpenFilename _
(filefilter:="Text files, *.txt", MultiSelect:=True)

If IsArray(myFileNames) Then
'keep going
Else
Exit Sub 'user hit cancel
End If

For iCtr = LBound(myFileNames) To UBound(myFileNames)
'do your stuff
Next iCtr

'....

End Sub

===
when that file|open dialog is displayed, you can click, ctrl-click, and
shift-click to get a bunch.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top