Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to use VBA

Status
Not open for further replies.

drrocket5292

Technical User
Sep 6, 2005
73
US
I just started using Extra Basic this week and have been searching through this forum for all sorts of answers the past couple of days. I'm trying to be able to use Extra in VBA but every time I type the code in to initailize a session I get an error message that says "ActiveX Component Can't create object." Here is my code but its just the same code that you see posted a hundred times in this forum:


Public Sessions As Object
Public System As Object
Public Sess0 As Object

Sub whydontyouwork()

'Extra Objects
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then MsgBox "Could not create the EXTRA System object. Stopping macro playback.": Stop
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then: MsgBox "Could not create the Sessions collection object. Stopping macro playback.": Stop
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then MsgBox "Could not create the Session object. Stopping macro playback.": Stop


Set Sessions = Nothing
Set System = Nothing
Set Sess0 = Nothing


End Sub


I have searched my computer and every server I have access to and cannot find the Type Library for Extra. Its not in my references in Excel or in the components section either. Clearly I'm new at this so does anyone have any advice on how I can get this to work in Excel? Is there any place to download the type library so that I can just add a reference to it in Excel? I couldnt find it on the Attachmate website. Thanks for the help.
 
Calculus has a FAQ for adding the reference faq99-4069.

Not sure about the "ActiveX Component Can't create object." error. try the following code to see which objects giving you issues.

Code:
Public Sessions As Object
Public System As Object
Public Sess0 As Object

Sub whydontyouwork()
Dim thisobject As String

On Error GoTo whichobjecterror
'Extra Objects
    thisobject = "System"
    Set System = CreateObject("EXTRA.System")   ' Gets the system object
    thisobject = "Session"
    Set Sessions = System.Sessions
    thisobject = "Active Session"
    Set Sess0 = System.ActiveSession
    
    Set Sessions = Nothing
    Set System = Nothing
    Set Sess0 = Nothing

whichobjecterror:
    MsgBox thisobject
End Sub

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
its the system object. the line:

Set System = CreateObject("EXTRA.System")

is the one giving me problems. Any advice?
 
Are you using an older attachmate product??? Attachmate Accessory Manager ect.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
I'm using 6.5 and the above code works fine for me I'm sure its the CreateObject("EXTRA.System") to use on my older attachmate problem I had to use CreateObject("ACCMGR.System") but I'm not sure what yours may be. Sorry I couldn't be of more help. Were you able to get your reference?



[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Thanks for help anyway. I still havent been able to locate the type library. Any suggestions on where I could get it?
 
Search your drives for a "extra.tlb" file. If it's not present that could be the reason for your object issue and your reference issue.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
ive searched all of my drives for extra*.* and came up with nothing. does anyone have any idea where I could download the type library? i couldnt find it on the Attachmate Website. thanks.
 
It should be in the same directory as your Extra is installed. In VBA when you click Tools>References do you not see "Attachmate" listed? How about "MyExtra"?

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top