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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate, Run Time Error '13' Type mismatch, Early Binding

Status
Not open for further replies.

Dameat

Technical User
Oct 16, 2006
6
CA

Attachmate Extra and Excel VBA.
I've read the Faq and followed the code exactly.

The late binding works without problems.
(Public System as Object)
(Set System = CreateObject("Extra.System"))

As opposed to adding a reference and using the early binding:
(Public System as ExtraSystem)
(Set System = New ExtraSystem)

I would prefer to use the early binding to take advantage of the VBA intellisense prompts. However, the early binding does not work.I get a:
"Run Time Error '13' Type mismatch" message at the line:
"Set MyScn = Sess0.Screen"

I've tried several variations with the code with no luck. And I don't have the luxury of the one suggestion I did find which was to uninstall and re-install Attachmate.

 
How is MyScn dimmed? Is there a clas with the same name in higher priority (reference) library? If so, use full path declaration:

Dim MyScn As LibraryName.ClassName

Nb, there is attachmate forum99.

combo
 
Public System As ExtraSystem
Public Screen As ExtraScreen

Set System = New ExtraSystem
Set Screen = System.ActiveSession.Screen


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


 
What happens after:

Public Sess0 As ExtraSession
Public MyScn as ExtraScreen
..
Set Sess0 = System.ActiveSession
Set MyScn = Sess0.Screen

I would avoid variable names same as class or properties/methods names.

combo
 
Thanks for the suggestions, sorry I got the wrong forum, lost track which one I was in.

I put the following code into a new excelWB with just a command button pointing to the initial sub:

'*************
Option Explicit

Public exSystem As EXTRA.ExtraSystem
Public exSessions As EXTRA.ExtraSessions
Public exSess0 As EXTRA.ExtraSession
Public exScreen As EXTRA.ExtraScreen
Public exOIA As EXTRA.ExtraOIA

Public Sub Initial()
Set exSystem = New ExtraSystem
Set exSessions = exSystem.Sessions
Set exSess0 = exSystem.ActiveSession
Set exScreen = exSess0.Screen
Set exOIA = exScreen.OIA
End Sub

'****************

I prefixed everything with ex to avoid duplicate names. Decalared all the exra objects with "as EXTRA.Class"
I tried 'Set exScreen = exSystem.ActiveSession.exScreen'.

It's still doing the same thing.
At line 'Set exSess0 = exSystem.ActiveSession' I get a 'Run Time Error '13' Type mismatch' message.

Thanks again for the suggestions.
 
What are variable types in 'locals' window when you debug after error? Are there duplicate variables of different type in the vba project?
I could also, in object browser with 'show hidden members' set, try to trace methods used and their output object types.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top