Hi,
In VBA, it is relatively simple to look through all the files in a folder, and open all the *.doc files consecutively. How do you perform the same operation in Visual Basic 6, instead of in Visual Basic for Applications.
THanks
MS gives the following example in VBA it looks:
Set fs = Application.FileSearch
With fs
.LookIn = "A:"
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
MyDoc = .FoundFiles(i)
Documents.Open FileName:=MyDoc, ReadOnly:=True
' Do your thing ....
Documents(MyDoc).Close SaveChanges:=wdDoNotSaveChanges
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
In VBA, it is relatively simple to look through all the files in a folder, and open all the *.doc files consecutively. How do you perform the same operation in Visual Basic 6, instead of in Visual Basic for Applications.
THanks
MS gives the following example in VBA it looks:
Set fs = Application.FileSearch
With fs
.LookIn = "A:"
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
MyDoc = .FoundFiles(i)
Documents.Open FileName:=MyDoc, ReadOnly:=True
' Do your thing ....
Documents(MyDoc).Close SaveChanges:=wdDoNotSaveChanges
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub