G
Guest
I am trying to send an email with an attachment from Access 2007. I ran into
problems with getObject and createObject. The object is "Nothing" even if
Outlook is open. To try and isolate the problem, I created a new database to
do some testing with the following module
Sub test()
Dim objApp As Object
Dim blnOutlookInitiallyOpen As Boolean
On Error Resume Next
blnOutlookInitiallyOpen = True
Set objApp = GetObject(, "Outlook.Application")
If objApp Is Nothing Then
Set objApp = CreateObject("Outlook.Application")
' Outlook wasn't open when this function started.
blnOutlookInitiallyOpen = False
End If
If Err <> 0 Then Beep: _
MsgBox "Error in " & strProcName & " (1): " _
& Err.Number & " - " & Err.Description: _
End Sub
References are
- Visual Basic for Applications
- Microsoft Access 12.0 Object Library
- Microsoft Outlook 12.0 Object Library
- OLE Automation
- Microsoft DAO 3.6 Object Library
I posted the message on an Access Newsgroup and it was suggested that the
issue could be binding. I am not sure I really understand early and late
binding in spite of some technical stuff I have read but it doesn't seem to
change the situation.
I changed
Dim objApp As Outlook.Application
to:
Dim objApp As Object
Still get error 429 - Active X component can't create object.
I turned off Kaspersky AV and it made no difference. Not sure what to try
next.
problems with getObject and createObject. The object is "Nothing" even if
Outlook is open. To try and isolate the problem, I created a new database to
do some testing with the following module
Sub test()
Dim objApp As Object
Dim blnOutlookInitiallyOpen As Boolean
On Error Resume Next
blnOutlookInitiallyOpen = True
Set objApp = GetObject(, "Outlook.Application")
If objApp Is Nothing Then
Set objApp = CreateObject("Outlook.Application")
' Outlook wasn't open when this function started.
blnOutlookInitiallyOpen = False
End If
If Err <> 0 Then Beep: _
MsgBox "Error in " & strProcName & " (1): " _
& Err.Number & " - " & Err.Description: _
End Sub
References are
- Visual Basic for Applications
- Microsoft Access 12.0 Object Library
- Microsoft Outlook 12.0 Object Library
- OLE Automation
- Microsoft DAO 3.6 Object Library
I posted the message on an Access Newsgroup and it was suggested that the
issue could be binding. I am not sure I really understand early and late
binding in spite of some technical stuff I have read but it doesn't seem to
change the situation.
I changed
Dim objApp As Outlook.Application
to:
Dim objApp As Object
Still get error 429 - Active X component can't create object.
I turned off Kaspersky AV and it made no difference. Not sure what to try
next.