Dim Appword As word.application

J

john.9.williams

Hi

I am using this daclaration in a program

"Dim Appword As word.application"

when i run my program i get this error assigned to this

"Compile error userdefined type not defined"

I know i have to do something but not sure what, any help greatly
received

Johny
 
A

AA2e72E

Use:

Set AppWord=CreateObject("Word.Application")

OR:

Add the Word object library reference to your project
 
B

Bob Phillips

Have you created a reference to the Word type library? Go to
Tools>References, scroll down to Microsoft Word, and check it.
 
J

john.9.williams

Where would i use the Set appWord = CreateObject("Word.Application")
syntax
 
B

Bob Phillips

You would do that instead of

Set AppWord = New Word.Application

but note my other post.

--

HTH

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

Chip Pearson

You need to set a reference to the Word object library. In VBA,
go to the Tools menu, choose References, and scroll down to
Microsoft Word. Check that box.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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