User defined type not defined

B

BobS

I am trying to create a simple macro to insert some text into an OL 2007
message. When I run the macro, I am getting a compile error
"User-defined type not defined." Can someone tell me what commands I
need to insert or change? Thank you.

This is my code.

Sub Greetings()
'
' Greetings Macro
' Macro recorded 9/4/2009 by Bob
'
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' get a Word.Selection from the open Outlook item
Set objDoc = Application.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
' now do what you want with the Selection
objSel.TypeText Text:= _
"Greetings Patrick,"
objSel.TypeParagraph
objSel.TypeParagraph
objSel.TypeParagraph
objSel.TypeParagraph
objSel.TypeText Text:="God is good, all the time, "
objSel.TypeParagraph
objSel.TypeText Text:="Bob "
objSel.MoveUp Unit:=wdLine, Count:=4

Set objDoc = Nothing
Set objSel = Nothing
End Sub
 
B

Brian Tillman [MVP-Outlook]

I am trying to create a simple macro to insert some text into an OL 2007
message. When I run the macro, I am getting a compile error "User-defined
type not defined." Can someone tell me what commands I need to insert or
change? Thank you.

This is my code.

Ask code questions in microsoft.public.outlook.program_vba
 

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