![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#11
|
|||
|
|||
![]()
Got the answer. Found it in
http://blogs.msdn.com/synergist/arch...l-message.aspx in a message posted on Saturday, August 04, 2007 5:09 PM by a Gary. Per his suggestion I did the following: Created a Function to retrieve the current item: Function GetCurrentItem() As Object Dim objApp As Outlook.Application Set objApp = CreateObject("Outlook.Application") On Error Resume Next Select Case TypeName(objApp.ActiveWindow) Case "Explorer" Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = objApp.ActiveInspector.CurrentItem Case Else ' anything else will result in an error, which is ' why we have the error handler above End Select Set objApp = Nothing End Function 'From http://www.outlookcode.com/codedetail.aspx?id=50 Then invoked the function in my code as follows Public Sub GetContactTitleData() Dim oContact As Outlook.ContactItem Set oContact = GetCurrentItem() MsgBox oContact.Account End Sub I'll have to include some error trapping but I think the fundamentals are here, and they seem to work. Thanks to all who helped, especially Ken -- Sierk |
Ads |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CPAO: object reference not set to an instance of an object | Caroline | Outlook - Calandaring | 2 | November 29th 08 05:32 AM |
Use Treeview object | Boein | Outlook - Using Forms | 0 | June 10th 08 11:51 AM |
Why does the Address property of the Recipient object in the Outlook object model look funny? | Omatase | Outlook - General Queries | 2 | July 13th 07 10:09 PM |
Object reference not set to an instance of an object | [email protected] | Outlook - General Queries | 0 | May 17th 07 08:40 AM |
VBE Object for Outlook | Dave Miller | Outlook and VBA | 8 | January 31st 07 06:02 PM |