ru2cool
asked on
Excel VBA - Can't create object
I am trying to create an object variable in VBA which will use the TypeLib Information Objects library and I'm working with Excel 2007. I've done some research and discovered that the original file was named TLBINF32.DLL but was renamed to VSTLBINF.DLL. I was able to find VSTLBINF.DLL on my PC and include it as a reference in my VBAProject. However, when I try to initialize an object variable I get the following error message -
The code I used for testing is based on several examples I found on google. Granted, they were all referencing the original file TLBINF32.DLL so I'm not sure if I need to do something different. The main reason I am interested in this is so I can write code that will enumerate and list constants for various available COM/ActiveX objects. Any assistance would be greatly appreciated. The test code is listed below
Run-time error '429':
ActiveX component can't create object
The code I used for testing is based on several examples I found on google. Granted, they were all referencing the original file TLBINF32.DLL so I'm not sure if I need to do something different. The main reason I am interested in this is so I can write code that will enumerate and list constants for various available COM/ActiveX objects. Any assistance would be greatly appreciated. The test code is listed below
Sub Test()
Dim tliApp As TLI.TLIApplication
' The line below is where the error occurs. If I replace it
' with a MsgBox showing IsObject(tliApp) then the return
' value is True.
Set tliApp = New TLI.TLIApplication
End Sub
ASKER
imnorie, I tried that line of code but it yielded the same error message. After further research, I don't think I'll be able to accomplish what I originally wanted to. I searched the registry for the phrase 'TLI.TLIApplication' and it was not found. I know that in the past I've always been able to find any other usable COM objects in the registry. And, since I'm on a company computer, I don't have access to register anything that's not already there.
The article linked below is what gave me the idea to try this in VBA when I was unsuccessful with CreateObject("TLI.TLIAppli cation") in a VBScript file. I guess my assumption was that VBA could still access the methods/properties of the object directly from the DLL file. If that is actually case, please let me know what to do differently.
WSF Files
The article linked below is what gave me the idea to try this in VBA when I was unsuccessful with CreateObject("TLI.TLIAppli
WSF Files
In the Visual Basic Editor, choose Tools->References. Look through the list for TLI Application. If you find it, add a check mark. If you don't find it, then you will have to manually add a reference to the appropriate DLL.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
imnorie, I found a Microsoft article which indicates that the file TLBINF32.DLL was indeed shipped with VB6 but it makes no mention of Office. And, VSTLBINF.DLL is located in the Office folder on my PC (C:\Program Files\Common Files\Microsoft Shared\OFFICE12\VS Runtime). Article link below -
http://support.microsoft.c om/kb/2243 31
I did try your suggestion regarding the variable declaration but the results were the same. Code example below -
http://support.microsoft.c
I did try your suggestion regarding the variable declaration but the results were the same. Code example below -
Sub Test()
Dim tliApp As Object
Set tliApp = CreateObject("TLI.TLIApplication")
End Sub
In the Visual Basic Editor, choose Tools->References, click on Browse..., browse to C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\VS Runtime, and select the file VSTLBINF.DLL.
Then try running your code again.
Then try running your code again.
(or whatever version of Office you have installed)
ASKER
tdlewis, I have already done what you are now requesting which is the main reason for my opening question.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The file is in a folder called VS Runtime, doesn't that kind of give you a clue that it's for Visual Studio(VS).
Have you looked for TLBINF32.DLL anywhere else?
For some strange reason I've got it in C:\Windows\SysWow64.
No idea why it's there and it probably shouldn't be but I know it works.
Have you looked for TLBINF32.DLL anywhere else?
For some strange reason I've got it in C:\Windows\SysWow64.
No idea why it's there and it probably shouldn't be but I know it works.
ASKER
It is what it is I suppose. Thank you all for the feedback.
Open in new window