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
S BAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi Seb112860,

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

Cheers!
S BAuthor Commented:
A form that was created in Outlook via Tools > Forms > Design a form.
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?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

S BAuthor Commented:
Message.
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
S BAuthor 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
S BAuthor 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?
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.
S BAuthor 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.
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
S BAuthor 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.
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".
S BAuthor 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.
David LeeCommented:
Excellent.  You're welcome.  Glad I could help out.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.