Discussion Locked

Create object in Word

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am copying a file from Word to Outlook

I need to create an object in Word to solve the error:

User-defined type not defined

caused by:

Dim oOutlookApp As New Outlook.Application

My code works on the toolbar but not in a command button in Word.

Thank you.

3 replies

by peyison

Did my previous answer not work? Did you make sure you have a reference to the Outlook Library in the document that contains the command button? The problem is, without a reference to the Outlook library, Word doesn't know what "Outlook.Application"is, so it thinks it must be a user defined type. If you add the reference (as described in my answer to your previous question) it should work.

Hope this helps.

by hurdk

This answer is totally correct.
The answer helped me.
I had a misconception that I had to create an object as well as check the Outlook Object Library.
I also was not attaining the Outlook Object Library from the form.
I use alt F11 tools references.

This discussion is closed to new replies.