Converting RTF to DOCs

W

Ward

I have a folder full of RTF files saved with .doc extensions created by the
Adobe Acrobate 6.0 Standard Save As feature. I found the following macro
code at http://support.microsoft.com/default.aspx?scid=kb;en-us;242875:

Sub convert()

Dim strFile As String
Dim X As String
Dim Y As String
Dim Z As Object
'Collect Drive and directory to convert Word Docs in.
X = InputBox("Please enter the drive the documents are on.", "Drive
Letter", "C")
Y = InputBox("Please enter the path to the directory the files are in.",
"Path to files", "My Documents")
'seed the string to the first file in the directory
strFile = Dir(X & ":\" & (Y) & "\" & "*.rtf")
' Start looping through files opening and saving as current version of Word.
On Error Resume Next
Do While strFile <> ""
Documents.Open X & ":\" & (Y) & "\" & strFile, Format:=wdOpenFormatRTF
ActiveDocument.SaveAs (X & ":\" & Y & "\" & strFile), FileFormat =
wdFormatDocument
ActiveDocument.Close
strFile = Dir

Loop
'Alert user operation is complete
MsgBox "done"

End Sub

How do I convert this code into a stand-alone script file so I can
distribute it?
 
W

Word Heretic

G'day "Ward" <[email protected]>,

As your users run Word, stick the code in a document's VBA project
with a macrobutton in the document content to invoke it.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Ward reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top