RE: Word as Editor with Legault Code
- From: "Eric Legault [MVP - Outlook]" <elegaultZZZ@xxxxxxxxxxxxxxxxx>
- Date: Fri, 16 Sep 2005 09:38:01 -0700
Unfortunately, the NewInspector event is not fired if you use Word as the
editor. You'd have to intervene manually to grab the ActiveInspector object
(custom button click or something) and then call the code to generate the
body text.
--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard - http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
"puddytat_99@xxxxxxxxxxx" wrote:
> Windows XP
> Office XP
>
> Mr. Legault posted a random fortune generator that works wonderfully
> for me, but I would like to use Microsoft Word as my email editor. When
> I have my options set to use Word, I get errors with this code. It
> wants me to use outlook mail as my editor. Would some kindly soul help
> me modify the code so that I can use Word as my editor? I'm not very
> proficient. See code below:
>
> Option Explicit
> Dim WithEvents objInspectors As Inspectors
> Dim WithEvents objInspector As Inspector
>
>
> Private Sub Application_Startup()
> Set objInspectors = Application.Inspectors
> End Sub
>
>
> Private Sub Application_Quit()
> Set objInspectors = Nothing
> Set objInspector = Nothing
> End Sub
>
>
> Private Sub objInspector_Activate()
> Dim strFortune As String, intRandomNumber As Integer
> Dim objMailItem As Outlook.MailItem
>
>
> Randomize ' Initialize random-number generator.
> intRandomNumber = Int((3 * Rnd) + 1) ' Generate _
> random value between 1 and 3.
>
>
> Select Case intRandomNumber
> Case 1
> strFortune = "Fortune 1"
> Case 2
> strFortune = "Fortune 2"
> Case 3
> strFortune = "Fortune 3"
> End Select
>
>
> Set objMailItem = objInspector.CurrentItem
>
>
> objMailItem.Body = objMailItem.Body & strFortune
> End Sub
>
>
> Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
> If Inspector.CurrentItem.Class <> olMail Then Exit Sub
> Set objInspector = Inspector
> End Sub
>
>
.
- Prev by Date: Re: create appointment for current folder
- Next by Date: Re: Trouble creating an Error Handler correctly
- Previous by thread: Re: create appointment for current folder
- Next by thread: How did a NOTE get in my Inbox?
- Index(es):