Assign a variable to a word document

G

Guest

Hello,

I have done this before but I lost my notes... How do you assign a variable
to a Word document when you open it? I thought the following codes would be
enough but it gives me the "type mismatch" error. Thanks for you help!

Sub xyz()

Dim WordApp As Word.Application
Dim LetterTemplate As Word.Document

Set WordApp = New Word.Application
WordApp.Visible = True
Set LetterTemplate = WordApp.Documents.Open(Filename:="Blah Blah Blah",
ReadOnly:=True)

End sub
 
B

Bob Phillips

Anson,

Your code works fine for me, as long as I use a fully qualified, proper doc
path.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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