Sub Method1()
Dim strFiles As Variant
Dim lngIndex As Long
Dim strFile As String
strFiles = SelectFiles
If IsEmpty(strFiles) = False Then
For lngIndex = LBound(strFiles) To UBound(strFiles)
strFile = strFiles(lngIndex)
...
Next lngIndex
End If
End Sub
Sub Method2()
Dim strFiles As Variant
Dim strFile As Variant
strFiles = SelectFiles
If IsEmpty(strFiles) = False Then
For Each strFile in strFiles
...
Next lngIndex
End If
End Sub
Private Function SelectFiles() As Variant
Dim objComDlg As cCommonDialog
Dim strFldrName As String
Dim strFiles() As String
Dim lngFiles As Long
Set objComDlg = New cCommonDialog
With objComDlg
.DialogTitle = "Select files:"
.DefaultExt = "dwg"
.Filter = "Drawing files (*.dwg)|*.dwg"
.flags = OFN_EXPLORER Or OFN_ALLOWMULTISELECT Or OFN_HIDEREADONLY
.InitDir = ThisDrawing.Path
.ShowOpen
If .FileName <> "" Then
.ParseMultiFileName strFldrName, strFiles, lngFiles
If lngFiles > 1 Then
For lngFiles = LBound(strFiles) To UBound(strFiles)
If Right(strFldrName, 1) = "\" Then
strFiles(lngFiles) = strFldrName & strFiles(lngFiles)
Else
strFiles(lngFiles) = strFldrName & "\" & strFiles(lngFiles)
End If
Next lngFiles
End If
SelectFiles = strFiles
End If
End With
Set objComDlg = Nothing
End Function
"Greg Schmidt" wrote in message
news:7459839597FD8C47A43CC42C01A57A86@in.WebX.maYIadrTaRb...
> I have selected several drawings using the CommonDialog1.ShowOpen
statement.
> Now I need to step through each drawing with a "for each" statement. But
> "for each" what? file? object? I'm not sure. Please help
>
> Greg
>
>