Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

(VBA - Outlook) Getting a hook into the current appointment

Posted on 2004-10-13
2
Medium Priority
?
498 Views
Last Modified: 2008-03-06
Pretty simple...I just don't know the object model.

Here's the scenario:  

1. I open an appointment in Outlook
2. Within the appointment window that pops up, I click a custom button in my custom toolbar that activates a VBA macro
3. This macro comes up with a pointer to an object representing the OPEN appointment

I am looking for something like this:  

public sub poo()
    Dim objNS As Outlook.NameSpace
    Set objNS = Application.GetNamespace("MAPI")
    Set colCalendar = _
        objNS.GetDefaultFolder(olFolderCalendar).Items
    Set objNS = Nothing

    dim ai as appointmentitem
    set ai = colcalendar.thisdamnopenitem()
end sub
0
Comment
Question by:Snakie1066
2 Comments
 
LVL 16

Accepted Solution

by:
jimbobmcgee earned 700 total points
ID: 12296906
Try

   set ai = Application.ActiveInspector.CurrentItem

HTH

J.
0
 

Author Comment

by:Snakie1066
ID: 12299933
That worked. Thanks much.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

971 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