Excel and Word VBA

J

James

I can do Excel VBA but don't know Word VBA.

So far I have this code:
Dim wrd As Word.Application
Set wrd = CreateObject("Word.Application")


which just gives me a blank word document. I need help opening an
existing Word document and manipulating it (it is not already running).
Tks.
 
R

Ron de Bruin

Hi James

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("C:\ron.doc")
'your code
WD.ActiveDocument.Close
WD.Quit
Set WD = Nothing
End Sub
 
Top