RunI have a Word document that I attach to an Outlook message with VBA. As
of yesterday, it all of a sudden quit working after about two months of
working just fine. I've closed and re-opened Word and Outlook, restarted the
computer, everything I could think of, but still get this error:
Run-time error '429':
Active-X component can't create object
Any ideas on how to resolve this, and why it would go inoperable from one
day to the next?
Actually, I solved the 491 error, but now I'm getting this one:
Run-time error '91':
Object variable or With block variable not set
Following is the line where the error occurs; after that, I'll write the
complete section of code.
Set objItem = objOutlookApp.CreateItem(olMailItem)
On Error Resume Next
Set objOutlookApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If Err <> 0 Then
Set objOutlookApp = CreateObject("Outlook.Application")
blnStarted = True
End If
Set objItem = objOutlookApp.CreateItem(olMailItem)

Signature
Bryan
> RunI have a Word document that I attach to an Outlook message with VBA. As
> of yesterday, it all of a sudden quit working after about two months of
[quoted text clipped - 7 lines]
> Any ideas on how to resolve this, and why it would go inoperable from one
> day to the next?
Jezebel - 25 Aug 2006 01:51 GMT
The problem is that you are failing to instantiate objOutlookApp. The
mistake in your code is here
> On Error GoTo 0
> If Err <> 0 Then
All 'On error' statements clear the error object, so Err will always be zero
at this point. As you have it, the code will work if Outlook is already
running, but not otherwise. A simple fix is to use
On Error Resume Next
Set objOutlookApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If objOutlookApp is nothing then
...
> Actually, I solved the 491 error, but now I'm getting this one:
>
[quoted text clipped - 29 lines]
>> Any ideas on how to resolve this, and why it would go inoperable from one
>> day to the next?
muyBN - 25 Aug 2006 07:37 GMT
That was the trick. Thanks.

Signature
Bryan
> The problem is that you are failing to instantiate objOutlookApp. The
> mistake in your code is here
[quoted text clipped - 45 lines]
> >> Any ideas on how to resolve this, and why it would go inoperable from one
> >> day to the next?
muyBN - 28 Aug 2006 05:07 GMT
Well, durn, it worked once then gave an error again (something like "module
couldn't be created"); now I just tried it again so I could get the exact
error code, then it worked! Does anyone have ideas on why it would work once
then not the next time? Here's the code:
On Error Resume Next
Set objOutlookApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If objOutlookApp Is Nothing Then
Set objOutlookApp = CreateObject("Outlook.Application")
blnStarted = True
End If

Signature
Bryan
> That was the trick. Thanks.
>
[quoted text clipped - 47 lines]
> > >> Any ideas on how to resolve this, and why it would go inoperable from one
> > >> day to the next?
Russ - 02 Sep 2006 23:37 GMT
muyBN,
I'm new to invoking another app with code, but it might be that you need to
set objOutlookApp = Nothing to release it from memory when your done with it
before trying to create or set it again.
> Well, durn, it worked once then gave an error again (something like "module
> couldn't be created"); now I just tried it again so I could get the exact
[quoted text clipped - 8 lines]
> blnStarted = True
> End If

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID