Outlook Reply Form

Can someone tell me how to create a macro called RFP (Request for Projector) that when executed will enter text into the comment field of a reply form so that all I have to do is click on Send.  Any assistance will be greatly appreciated. My knowledge of VB is none.

Thanks in advance
Seb112860Asked:
Who is Participating?
 
David LeeCommented:
Ok, try this.

Sub RequestForProjector()
    Dim olkMessage As Object, _
        strText As String
    'Edit the text on the next line as desired.
    strText = "My standard text for Request for Projector."
    If Application.ActiveInspector.CurrentItem.Class = olNote Then
        Set olkMessage = Application.ActiveInspector.CurrentItem
        olkMessage.UserProperties("LP Reply Comments") = strText & olkMessage.UserProperties("LP Reply Comments")
        olkMessage.Display
    End If
End Sub
0
 
David LeeCommented:
Hi Seb112860,

> enter text into the comment field of a reply form
What kind of reply form?  A message?

Cheers!
0
 
Seb112860Author Commented:
A form that was created in Outlook via Tools > Forms > Design a form.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
David LeeCommented:
I understood that.  My question was what kind of form?  Is it one based on a message, on a task, an appointment, or something else?
0
 
Seb112860Author Commented:
Message.
0
 
David LeeCommented:
Here's the macro for doing this.  
1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expended, expand Modules and click on Module1
4.  Copy the macro and paste it into the right-hand pane of the VB editor window.
5.  Click the diskette icon on the toolbar to save the changes
6.  Close the VB Editor
7.  Click Tools->Macro->Security
8.  Change the Security Level to Medium

To use this, open a message and click reply or forward.  Now run the macro.  It'll insert your text at the top of the message.

Sub RequestForProjector()
    Dim olkMessage As Outlook.MailItem, _
        strText As String
    'Edit the text on the next line as desired.
    strText = "My standard text for Request for Projector."
    If Application.ActiveInspector.CurrentItem.Class = olMail Then
        Set olkMessage = Application.ActiveInspector.CurrentItem
        If olkMessage.BodyFormat = olFormatHTML Then
            olkMessage.HTMLBody = strText & olkMessage.HTMLBody
        Else
            olkMessage.Body = strText & olkMessage.Body
        End If
        olkMessage.Display
    End If
End Sub
0
 
Seb112860Author Commented:
When I ran the macro, it didn't give me any errors but it didn't insert any text into the comments field.  Any ideas?

Thanks in advance
0
 
Seb112860Author Commented:
Please accept my appologies.  When I ran the code on a regular message after clicking on reply it worked in the body of the message.  I guess the form is something other than a message.  How can I tell exactly what the form is created from?
0
 
David LeeCommented:
Launch the form designer (Tools->Forms->Design a Form) and select this form.  Look toward the bottom of that dialog-box and you'll see the type of form.  It'll begin with "IPM."  Go ahead and open the form in the designer and select that field.  Let me know what the field name is.
0
 
Seb112860Author Commented:
It's a IPM.Note and the name of the field is TextBox1.  On the Value tab next to Choose Field it says LP Reply Comments.
0
 
Seb112860Author Commented:
It didn't work.  When I try it in a regular message and change olNote to olMail it works but it doesn't work when I click on reply on a form and click in the comments field and execute the macro.
0
 
David LeeCommented:
I can only think of two explanations.  One, the form class is not IPM.Note or two, the field name is not "LP Reply Comments".
0
 
Seb112860Author Commented:
I recopied the code and changed olNote to olMail and tried again and I was pleasantly shocked when it worked.  I tried exactly what you instructed me to and it didn't work but decided to try again and the second time around it did work.

Thanks so much for all of your assistance.
0
 
David LeeCommented:
Excellent.  You're welcome.  Glad I could help out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.