Solved

Add contact name, phone, and address to subject when scheduling appointment

Posted on 2006-06-10
1
175 Views
Last Modified: 2010-04-07
Hello,

I am using the below code to Add contact name, phone, and address to subject when scheduling appointments outlook.  Would some please tell me how to put spaces or dases between each of the entries?




Sub MakeAppointment()
    Dim olkAppointment As Outlook.AppointmentItem, _
        olkContact As Outlook.ContactItem
    Set olkContact = Application.ActiveExplorer.Selection.Item(1)
    Set olkAppointment = Application.CreateItem(olAppointmentItem)
    olkAppointment.Location = olkContact.BusinessAddressCity
    olkAppointment.Subject = olkContact.HomeTelephoneNumber & olkContact.BusinessTelephoneNumber & olkContact.FullName & olkContact.HomeAddress & (olkContact.BusinessAddress)
    olkAppointment.Links.Add olkContact
    olkAppointment.Display
    Set olkContact = Nothing
End Sub
0
Comment
Question by:agrafixx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 16877455
Hi agrafixx,

Try this...

Sub MakeAppointment()
    Dim olkAppointment As Outlook.AppointmentItem, _
        olkContact As Outlook.ContactItem
    Set olkContact = Application.ActiveExplorer.Selection.Item(1)
    Set olkAppointment = Application.CreateItem(olAppointmentItem)
    olkAppointment.Location = olkContact.BusinessAddressCity
    olkAppointment.Subject = olkContact.HomeTelephoneNumber & "-" & olkContact.BusinessTelephoneNumber & _
                    "-" & olkContact.FullName & "-" & olkContact.HomeAddress & "-" & (olkContact.BusinessAddress)
    olkAppointment.Links.Add olkContact
    olkAppointment.Display
    Set olkContact = Nothing
End Sub

Regards,

Wayne
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question