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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro on Directory of Files 1

Status
Not open for further replies.

dansleight

IS-IT--Management
Dec 6, 2000
25
0
0
US
I have a directory of a large number of RTF files. I need to open each one, apply an image, then save the file as a .doc file (saving as rtf makes the file 20megs, saving as doc makes the file 1meg).

My question is is this possible? I need a hint as to how to apply a Macro to the entire directory.
 
Hi there,

I don't know about the details of applying the code itself but here is your hint about doing it for a whole directory (it loops through the directory to find each RTF file)

Code:
Sub MySub
   Dim MyFile as String
   
   MyFile = Dir("MyPath\MyDirectory\*.RTF")
   Do While MyFile <> &quot;&quot;
     'Open MyFile; Apply image; Save as doc; Close file
     MyFile = Dir
   Loop
End Sub

Good luck,

Nath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top