Jaa


Updated Outlook Macro for Creating Appointments

Last year I created a simple macro for Microsoft Outlook 2007 that automatically created an appointment from an email, adding the recipients to the appointment invite.  Apparently there has been quite a bit of interest in this, most recently someone asked if it could be modified so that it would work with the previewed email in addition to an opened email.  Well I looked at the code again and found that it was pretty easy to do: 

If the active inspector is null, then no item is opened.  I then check to see if the preview pane is visible and if it is, I get the first selected item (because only the first item is previewed). 

I have attached the updated source code for your use and productivity.  Thanks for all of your suggestions!

     ...
    Dim app As New Outlook.Application
    Dim item As Object
    
    If app.ActiveInspector Is Nothing Then
        If app.ActiveExplorer.IsPaneVisible(olPreview) Then
            Set item = app.ActiveExplorer.Selection.item(1)
        End If
    Else
        Set item = app.ActiveInspector.CurrentItem
    End If
    
    If item Is Nothing Then Exit Sub
    
    If item.Class <> olMail Then Exit Sub
    ....

NewMeetingRequestFromEmail.bas

Comments

  • Anonymous
    April 23, 2008
    PingBack from http://microsoftnews.askpcdoc.com/vba/updated-outlook-macro-for-creating-appointments

  • Anonymous
    April 23, 2008
    Hey there, I was the bloke interested in having it done from the preview pane. And woaw, that was done quickly. Indeed, it works like a charm. Thanks a lot! :D

  • Anonymous
    May 30, 2008
    Here is something we are working on. We are using your code (thank you) but want a rule to create a calendar event. We have found how to do this but your code and the above code need to have a window open or have a preview. What if you don't need or want to see the email. What happens is that a helpline sends an email to me saying I have a call and need to contact the client. I then have to create a calendar event for this. It would be nice if a rule could grab the info out of the email and create the calendar event for me. Saves me some time. Can this be done or does a active window need to be open?

  • Anonymous
    May 30, 2008
    A programmer friend helped me out. I am almost there.

  • Anonymous
    July 20, 2008
    in office2007 it is enaught to drag & drop mail to Calendar or task. Drag with right button for more options

  • Anonymous
    October 09, 2008
    Tired of having to add the e-mail addresses to a meeting by drag & dropping the e-mail on the Calender, I very much enjoyed your article solving this problem. Implementing the macro I unfortunately found that Outlook 2003 has a new security feature in showing a display with: "a program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?" and allowing a time window of 1,2 or 5 minutes. For the record: a selfcert certificate does not help in this case. Luckily I found a simple solution to this browsing the internet by letting the macro not use a new instance of the outlook application object (thus triggering the security response), but using the outlook application object itself with results in a few changes in the VBA code which I hope you will adopt (after testing of course): Replace    ...    Dim app as new outlook.application    ... By    ...            Dim app As Outlook.Application    Set app = Application    ... Cheers, Arnoud Bergman afbergman(at)zonnet.nl

  • Anonymous
    October 29, 2008
    hi there, i'm looking for a different macro but i hope you could help me. i'm trying to get my calendar better organized with all the meetings that i have. often i don't have time between meetings to either prepare for or even get from one meeting to another. i would like to have a macro that automatically adds 15 minutes to each meeting at its beginnnig and/or end. could anyone help me? thanks, evert

  • Anonymous
    December 02, 2008
    The comment has been removed

  • Anonymous
    January 07, 2009
    The comment has been removed

  • Anonymous
    May 08, 2009
    Is there a way to create a macro and attach it to an outgoing message so that when the message arrives in the recipients Inbox an appointment is automatically created? What we are attempting to accomplish is to give every receipient of an upgrade email message a reminder to reboot their machine 3 days after receiving the email. We think that a macro attached to an outgoing mail message which runs as soon as the message is received may accomplish this. Thank you!

  • Anonymous
    July 15, 2009
    Hi there... At work we use our calendar as a timesheet and recently have begun looking into macros to speed the process... How would a macro that takes the start time and end time, and put it into the body as total time work? If you could help with this, that would be great! Thanks Lachlan

  • Anonymous
    October 06, 2009
    Hello, This may not be the right place but I am getting desperate.  I have a VBA script to create a new outlook appointment fom an Access form but I cannot figure out how to update an existing appointment through the script.  I have been trying to us the GlobalAddressID and the EntryID properties as a way of identifying the item but I cannot get anything to work. Can you please help?

  • Anonymous
    April 30, 2010
    The comment has been removed

  • Anonymous
    April 15, 2012
    Has anyone gotten this macro to work under Windows 7? It works fine under Windows XP but won't work in Windows  7.