Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting file by filenames

Status
Not open for further replies.

lemonhalls

Technical User
Jun 11, 2004
52
CA
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top