OL2003 - designing a macro

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I would like to make a button for a contact form that
takes information from the contact form and enters it
automatically into an email. The button would be called
PROFILE and when depressed or clicked would take, First
Name, Last Name, email address, phone number and a number
of other fields from the contact form and would
automatically enter them into an email so it looks like
this:

PROFILE:
Full Name: Jeff Strachan
email: (e-mail address removed)
home phone: (604) 677-6556

Anyone have any ideas? I suspect I have to create a macro
but I have never tried to make one before... this looks
challenging... Please help!
 
Here is a sample that might get you going in the right
direction. It has no error trapping, so it will only
work if you first select the desired contact and then run
the macro (which can be assigned to a toolbar button:

Sub MacroTrial()
Dim olApp As Outlook.Application
Dim olContact As Outlook.ContactItem
Dim objMail As Outlook.MailItem
Dim sBody As String
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)

Set olContact = Outlook.ActiveExplorer.Selection.Item(1)
sBody = "Follow-up Needed: " & olContact.FullName &
vbCrLf & vbCrLf & "email address: " &
olContact.Email1Address

With objMail
.Body = sBody
.Display
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top