Prev: Error "Cannot Start Microsoft Outlook. Cannot Open the Outlook Win
Next: Scan emails for virusus?
From: BobS on 1 May 2010 15:17 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
From: Brian Tillman [MVP-Outlook] on 3 May 2010 09:10 "BobS" <Bob-No(a)spam.com> wrote in message news:OyMpmLW6KHA.3880(a)TK2MSFTNGP04.phx.gbl... >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]
|
Pages: 1 Prev: Error "Cannot Start Microsoft Outlook. Cannot Open the Outlook Win Next: Scan emails for virusus? |