lemonhalls
Technical User
Inside a folder, i would like to look for files with the word "summaryxxx", "reportxxxs" and "milestonexxx"
then insert theses three files one after another then the rest of the files in the folder to be inserted after these.
I'm not sure how to do the search for the names, but got the going into a folder and insert the files one after another.
any help will be appreciated!
_________________________________
For i = 1 To .FoundFiles.Count
'checks to see if the file being opened has the same name
'as this current file ie Reporting_v8.doc or ~$porting_v8.doc
If .FoundFiles(i) <> ActiveDocument.Path & Application.PathSeparator & _
ActiveDocument.Name And _
.FoundFiles(i) <> ActiveDocument.Path & Application.PathSeparator & "~$" & _
Right(ActiveDocument.Name, (Len(ActiveDocument.Name) - 2)) Then
'inserting each file one after another
Selection.InsertFile FileName:=.FoundFiles(i), Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
'go to sub cleanUpWebFiles
cleanUpWebFiles
Else
End If
'increase count of i by 1
Next i
then insert theses three files one after another then the rest of the files in the folder to be inserted after these.
I'm not sure how to do the search for the names, but got the going into a folder and insert the files one after another.
any help will be appreciated!
_________________________________
For i = 1 To .FoundFiles.Count
'checks to see if the file being opened has the same name
'as this current file ie Reporting_v8.doc or ~$porting_v8.doc
If .FoundFiles(i) <> ActiveDocument.Path & Application.PathSeparator & _
ActiveDocument.Name And _
.FoundFiles(i) <> ActiveDocument.Path & Application.PathSeparator & "~$" & _
Right(ActiveDocument.Name, (Len(ActiveDocument.Name) - 2)) Then
'inserting each file one after another
Selection.InsertFile FileName:=.FoundFiles(i), Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
'go to sub cleanUpWebFiles
cleanUpWebFiles
Else
End If
'increase count of i by 1
Next i