Hi,
I have a created a macro in Word to access various files in a directory, and to perform such actions on those files. This macro worked fine and the first lines are shown below.
When I want to use the same code in a stand-alone VB6 exe file, it does not seem to work anymore. An error variable Application not defined is shown. Any help?
Set fs = Application.FileSearch
With fs
.LookIn = "A:"
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
strBestand = .FoundFiles(i)
Documents.Open FileName:=strBestand, ReadOnly:=True
' Roep een procedure aan die alle Prestaties opzoekt
Call SchrijfNaarArray
Documents(strBestand).Close SaveChanges:=wdDoNotSaveChanges
Next i
Else
MsgBox "There were no files found."
End If
Call KopieerNaarExcel
End With
End Sub
I have a created a macro in Word to access various files in a directory, and to perform such actions on those files. This macro worked fine and the first lines are shown below.
When I want to use the same code in a stand-alone VB6 exe file, it does not seem to work anymore. An error variable Application not defined is shown. Any help?
Set fs = Application.FileSearch
With fs
.LookIn = "A:"
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
strBestand = .FoundFiles(i)
Documents.Open FileName:=strBestand, ReadOnly:=True
' Roep een procedure aan die alle Prestaties opzoekt
Call SchrijfNaarArray
Documents(strBestand).Close SaveChanges:=wdDoNotSaveChanges
Next i
Else
MsgBox "There were no files found."
End If
Call KopieerNaarExcel
End With
End Sub