Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Outlook 2007 - catch an event when user creates a new appointment

Posted on 2011-10-10
3
Medium Priority
?
295 Views
Last Modified: 2012-05-12
I got irritated with the warning dialog that says "no location has been specified" whenever I send a meeting invite in Outlook 2007 with blank location.  There seems to be no way to turn this warning off, so I thought maybe if I write VBA to automatically set the location to " " (single space) whenever I create a new appointment, that would be a reasonable work around.

I tried the following code.  However, it only seems to be triggered when the user saves changes to the new appointment.  I want to catch an event when the new appointment dialog first appears, e.g. when the user first double clicks in the Calendar to create a new appointment.

Of course, any suggestions for alternative approaches to solving the original problem are very welcome too!

Private WithEvents olkCalendar As Items

Private Sub Application_Quit()
    Set olkCalendar = Nothing
End Sub

Private Sub Application_Startup()
    Set olkCalendar = Session.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub olkCalendar_ItemAdd(ByVal Item As Object)
    If Item.Location = "" Then
      Item.Location = " "
      Item.Save
    End If
End Sub

Open in new window

0
Comment
Question by:jan24
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 36946347
Hi, jan24.

There aren't any events triggered triggered specifically by opening an appointment.  However there is an event triggered when an item, any type of item, is opened.  That event is the NewInspector event.  If you trap that event, then you can can test to see if the item open in the inspector window is an appointment.  If it is, then you can check to see if the location field is blank and fill it in if it is.  Something like this.
Private WithEvents olkInspectors As Outlook.Inspectors

Private Sub Application_Startup()
    Set olkInspectors = Application.Inspectors
End Sub

Private Sub Application_Quit()
    Set olkInspectors = Nothing
End Sub

Private Sub olkInspectors_NewInspector(ByVal Inspector As Inspector)
    Dim olkAppt As Outlook.AppointmentItem
    If Inspector.CurrentItem.Class = 26 Then
        Set olkAppt = Inspector.CurrentItem
        If olkAppt.Location = "" Then
            olkAppt.Location = "Some Value"
        End If
    End If
End Sub

Open in new window

0
 
LVL 2

Author Comment

by:jan24
ID: 36948707
That worked perfectly, BlueDevilFan.  Many thanks for your help!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 36948792
You're welcome!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article lists the top 5 trialware OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their Exchange server is no longer available or other critical issues with Exchange server or impo…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

580 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