A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Outlook » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

User defined type not defined



 
 
Thread Tools Display Modes
  #1  
Old May 1st, 2010, 08:17 PM posted to microsoft.public.outlook.general
BobS
external usenet poster
 
Posts: 5
Default User defined type not defined

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

  #2  
Old May 3rd, 2010, 02:10 PM posted to microsoft.public.outlook.general
Brian Tillman [MVP-Outlook]
external usenet poster
 
Posts: 2,485
Default User defined type not defined

"BobS" wrote in message
...

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
--
Brian Tillman [MVP-Outlook]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.