From: Bob Butler on
"Matt Connor" <mattc(a)sytation.com> wrote in message
>>> I have some code which uses CreateObject
>>> Dim XLApp As Object
>>> Set XLApp = CreateObject("Excel.Application")

Can you determine at this point what the value of Err.Number and
Err.Description are?
Can you check TypeName("Excel.Application") to see what you are getting
back?

>>> MsgBox XLApp.Version
>>>
>>> On most PCs this works fine but we have 2 new (Win XP) PCs where
>>> this produces Error 91 Object variable or With block variable not
>>> set

I'm assuming the error occurs on the Msgbox line. If XLApp is not set then
some other error must have occurred earlier that you are ignoring. Working
backwards to find that might help.

>>> The error occurs even when logged in with Administrator rights
>>>
>>> Also the above example uses Excel but the error ocurs with ANY
>>> CreateObject

Within this app or have you tried creating a new application that just tests
the use of CreateObject? (if CreateObject is failing I'd expect a lot of
widespread system problems)

Have you by chance defined your own CreateObject function in the app?
Right-click on the CreateObject name and choose 'definition'. It should
take you to the VBA.Interaction.CreateObject function in the object browser.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

First  |  Prev  | 
Pages: 1 2
Prev: Run time error 3021
Next: VBA CODE - ADODB