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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commondialog, select multiple files

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
hi,
I am trying to make conversion program.

This is what I have so far.

1. I can convert one file
2. I can select more than one file.
3. but, when I convert more than one file, error occurs.

I do not know how to convert mutiple files.

Would you please help me??
========================================
Private Sub Convert_Click()

Dim i As Integer
Dim FileName As String
Dim sFile() As String


On Error Resume Next
CommonDialog1.Filter = "Web Files|*.htm;*.html"
'CommonDialog1.Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
CommonDialog1.Flags = cdlOFNHideReadOnly Or cdlOFNPathMustExist Or cdlOFNAllowMultiselect Or cdlOFNExplorer
CommonDialog1.FileName = vbNullString
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName

'=======
If FileName <> "" Then
'Clear Rich Text content
RichTextBox1.Enabled = False
RichTextBox1.Text = vbNullString
'Convert - Modules
'===
Call ConvertFile(FileName) 'conversion part
'====
RichTextBox1.Enabled = True
RichTextBox1.Refresh
SmartMenuXP1.MenuItems.Enabled(3) = True
SmartMenuXP1.MenuItems.Enabled(11) = True
SmartMenuXP1.MenuItems.Enabled(13) = True
SmartMenuXP1.MenuItems.Enabled(14) = True
SmartMenuXP1.MenuItems.Enabled(15) = True
SaveButton.Enabled = True

'====

End If
'======

End Sub
 
Use an array for the filenames:

dim FileArray() as string

FileArray() = Split(CommonDialog1.FileName,CHR$(0))

Here you have the path in FileArray(0) and all the filenames in the other items of the array.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top