Hello all,
as many of you probably know microsoft isn't invluding the filesearch object anymore in office 2007. There are some people writin a replacement. You can follow there efforts here :
Meanwhile I've got a big problem because our main tool isn't working anymore. I didn't write the ap and my vba skills just aren't enough to rewrite this. So my question..Can anybody help me out to rewrite this little piece of code to get it working again. I already tried but i just can't do it
this is the code:
With Application.FileSearch
.NewSearch
.LookIn = CurrentDbDir() + "Sjablonen\Documenten\"
.SearchSubFolders = True
'--------------------------------
'- Zoeken naar Word-sjablonen -
'--------------------------------
.FileName = "*.dot"
If .Execute(msoSortByFileName, msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
Lengte = Len(.FoundFiles(i))
If Left$(.FoundFiles(i), 2) <> "~$" Then
Me.Sjabloon = Mid$(.FoundFiles(i), 28, (Lengte - 31))
Me.VolledigePath = .FoundFiles(i)
DoCmd.OpenQuery "qrySjabloonToevoegen"
Else
MsgBox "Else"
End If
Next i
Else
MsgBox "Er zijn geen bestanden gevonden"
End If
'--------------------------------
'- Zoeken naar Excel-sjablonen -
'--------------------------------
.FileName = "*.xlt"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Lengte = Len(.FoundFiles(i))
Me.Sjabloon = Mid$(.FoundFiles(i), 28, (Lengte - 31))
Me.VolledigePath = .FoundFiles(i)
DoCmd.OpenQuery "qrySjabloonToevoegen"
Next i
End If
End With
Thanks to all help!
grob
as many of you probably know microsoft isn't invluding the filesearch object anymore in office 2007. There are some people writin a replacement. You can follow there efforts here :
Meanwhile I've got a big problem because our main tool isn't working anymore. I didn't write the ap and my vba skills just aren't enough to rewrite this. So my question..Can anybody help me out to rewrite this little piece of code to get it working again. I already tried but i just can't do it
this is the code:
With Application.FileSearch
.NewSearch
.LookIn = CurrentDbDir() + "Sjablonen\Documenten\"
.SearchSubFolders = True
'--------------------------------
'- Zoeken naar Word-sjablonen -
'--------------------------------
.FileName = "*.dot"
If .Execute(msoSortByFileName, msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
Lengte = Len(.FoundFiles(i))
If Left$(.FoundFiles(i), 2) <> "~$" Then
Me.Sjabloon = Mid$(.FoundFiles(i), 28, (Lengte - 31))
Me.VolledigePath = .FoundFiles(i)
DoCmd.OpenQuery "qrySjabloonToevoegen"
Else
MsgBox "Else"
End If
Next i
Else
MsgBox "Er zijn geen bestanden gevonden"
End If
'--------------------------------
'- Zoeken naar Excel-sjablonen -
'--------------------------------
.FileName = "*.xlt"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Lengte = Len(.FoundFiles(i))
Me.Sjabloon = Mid$(.FoundFiles(i), 28, (Lengte - 31))
Me.VolledigePath = .FoundFiles(i)
DoCmd.OpenQuery "qrySjabloonToevoegen"
Next i
End If
End With
Thanks to all help!
grob