• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

How to customize email form with custom text?

I want to customize my email form with the following capability - add 3-4 buttoms with custom text that depending on the email I can click a button the text would be generated and I can simply hit send. I know its pretty simple to do  . ..but need help.
Thanks.
0
Starquest321
Asked:
Starquest321
  • 5
  • 4
1 Solution
 
David LeeCommented:
Hi, Starquest321.

You don't need a custom form to accomplish this.  It can be done easily enough with a simple bit of scripting.  The advantage to scripting this is that custom forms require all parties to have the custom form.  If scripting sounds like a possibility, then I can provide the code and instructions on how to use it.
0
 
Starquest321Author Commented:
Scripting works well...can you show me?
0
 
David LeeCommented:
Ok.  Do you want to create the message with a predefined subject and text in the body, or do you want to insert predefined text in the message?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
Starquest321Author Commented:
Predefined text....
0
 
Starquest321Author Commented:
Actually can you give me both? And include the ability to put in an attached PDF file.... this can really be useful
0
 
David LeeCommented:
Okay, here they are.  Follow these instructions to use them.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Modules and click on Module1
4.  Copy the code below and paste it into the right-hand pane of the VB Editor.
5.  Edit the code as needed.  I've placed comment lines immediately before where changes need to/can be made.  Duplicate the TextInsert macro as needed.  You'll want one for each different chunk of text you might want to insert.
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools->Macro->Security
9.  Change the Security Level setting to Medium
10.  Click View->Toolbars->Customize
11.  Click the Toolbars tab
12.  Click New
13.  Name the toolbar
14.  Click the Commands tab
15.  Under Categories click Macros
16.  Under Commands click and hold on the macro Project1.CreateCannedMessage, then drag it out and drop it on the new toolbar.  Repeat this step for each TextInsert macro.
17.  Dock the toolbar somewhere onscreen
18.  You're ready to go
19.  Any time you want to request a receipt just click the toolbar button for this macro.  The macro will only work if it's clicked with a message item open.

The code is very simple.  When you click the button that fires the CreateCannedMessage macro the code will create a new message, set the subject and body with predefined text, and display the resulting message on screen.  When you click a button that fires a TextInsert macro the code enters the text wherever the cursor is currently positioned.  

Sub CreateCannedMessage()
    Dim olkMessage As Outlook.MailItem
    Set olkMessage = Application.CreateItem(olMailItem)
    With olkMessage
        .BodyFormat = olFormatHTML
        'Edit the subject and message body as desired.
        .Subject = "My Subject Text"
        .HTMLBody = "My message text."
        .Display
    End With
    Set olkMessage = Nothing
End Sub

Sub InsertCannedTextIntoMessage(strText As String)
    SendKeys strText, True
End Sub

Sub TextInsert1()
    InsertCannedTextIntoMessage "Text to be inserted."
End Sub
0
 
David LeeCommented:
Ignore step #19.  I copied the instructions from a previous question and forgot to remove that step.
0
 
Starquest321Author Commented:
You rock! Thanks.
0
 
David LeeCommented:
Thanks, and you're welcome.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now