neilabbott
Technical User
- Mar 11, 2003
- 19
By massaging earlier code for creating new OL items I put the following together. The aim is to hit a command button to display the appropriate OL contact item using the 'Fullname' field entry as stored in the record as OLID (linked to GCCGContacts folder to Access database).
I am now stuck with an "object variable not set" error at Line X. The DIMming and SETting is driving me crazy!
Can someone set me right? thanks
Code used is as follows
Function InitializeOutlook() As Boolean
On Error GoTo Init_Err
Set golApp = New Outlook.Application
Set golNameSpace = golApp.GetNamespace("MAPI"
InitializeOutlook = True
Init_Bye:
Exit Function
Init_Err:
InitializeOutlook = False
Resume Init_Bye:
End Function
-----------------------------------
Private Sub OpenContact_Click()
Dim strContact As String
strContact = Me!OLID
If OpenContactForm(strContact) = True Then
End If
End Sub
----------------------------------------------
Function OpenContactForm(varContact As Variant) As Boolean
Dim objContact As Outlook.ContactItem
Dim objFolder As Outlook.MAPIFolder
Dim myFolder As Outlook.MAPIFolder
Dim mynewfolder As Outlook.MAPIFolder
Dim blnResolveSuccess As Boolean
If golApp Is Nothing Then
If InitializeOutlook = False Then
MsgBox "unable initialize Outlook - what next?"
Exit Function
End If
End If
Set golApp = New Outlook.Application
LINE X Set mynewfolder = myFolder.Folders("GCCGContacts"
Set objContact = mynewfolder.Items.Find("[Fullname] = varContact"
With objContact
.Display
End With
End Function
-------------------------
I am now stuck with an "object variable not set" error at Line X. The DIMming and SETting is driving me crazy!
Can someone set me right? thanks
Code used is as follows
Function InitializeOutlook() As Boolean
On Error GoTo Init_Err
Set golApp = New Outlook.Application
Set golNameSpace = golApp.GetNamespace("MAPI"
InitializeOutlook = True
Init_Bye:
Exit Function
Init_Err:
InitializeOutlook = False
Resume Init_Bye:
End Function
-----------------------------------
Private Sub OpenContact_Click()
Dim strContact As String
strContact = Me!OLID
If OpenContactForm(strContact) = True Then
End If
End Sub
----------------------------------------------
Function OpenContactForm(varContact As Variant) As Boolean
Dim objContact As Outlook.ContactItem
Dim objFolder As Outlook.MAPIFolder
Dim myFolder As Outlook.MAPIFolder
Dim mynewfolder As Outlook.MAPIFolder
Dim blnResolveSuccess As Boolean
If golApp Is Nothing Then
If InitializeOutlook = False Then
MsgBox "unable initialize Outlook - what next?"
Exit Function
End If
End If
Set golApp = New Outlook.Application
LINE X Set mynewfolder = myFolder.Folders("GCCGContacts"
Set objContact = mynewfolder.Items.Find("[Fullname] = varContact"
With objContact
.Display
End With
End Function
-------------------------