Help please guy's!
Can anyone one work out why I'm getting 'Compile error' Type Mismatch
on this line "MsgBox "Error: " & Err & " " & Error"
I'm trying to set up a command button that adds to Outlook on my form.
Can anyone one work out why I'm getting 'Compile error' Type Mismatch
on this line "MsgBox "Error: " & Err & " " & Error"
I'm trying to set up a command button that adds to Outlook on my form.
Public Function fncAddToOutlook()
On Error GoTo StartError
Dim objOutlook As Outlook.Application
Dim objItem As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objItem = objOutlook.CreateItem(olContactItem)
With objItem
.FullName = [ContactName]
.Email1Address = [Email1AddressOne]
.CompanyName = [CompanyName]
.BusinessAddress = [1stLineOfAddress]
.BusinessAddressCity = [City]
.BusinessAddressPostalCode = [PostCode]
.BusinessTelephoneNumber = [PhoneNumber 1]
.MobileTelephoneNumber = [Mobile]
.Categories = [EmployeeName]
End With
objItem.Display
Set objOutlook = Nothing
Exit Function
StartError:
MsgBox "Error: " & Err & " " & Error
Exit Function
End Function