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
 

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