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!

VBA EXCEL ActiveX Component Can't Create Object in Reflection Workspace

Status
Not open for further replies.

Jun Mundia

Programmer
Jul 28, 2017
6
PH
Hello,

Did anyone encountered and had a solution when trying to bind the Reflection Workspace 2014 in Excel VBA. I'm getting an error when creating a object. Saw a post on the related subject by sharonniles, however didn't saw the issue was resolved. here is the code below. Please help.

Dim oTerminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.ibmTerminal
Dim oApp As Attachmate_Reflection_Objects_Framework.ApplicationObject
Dim oFrame As Attachmate_Reflection_Objects.frame
Dim oView As Attachmate_Reflection_Objects.view

Set oApp = New Attachmate_Reflection_Objects_Framework.ApplicationObject
If (oApp Is Nothing) Then
MsgBox "Unable to create Attachmate Workspace Application", vbCritical, "Application Workspace Error"
GoTo Obj_Release
End If

Set oFrame = oApp.GetObject("Frame")
If (oFrame Is Nothing) Then
MsgBox "Unable to create Attachmate Workspace Frame", vbCritical, "Workspace Frame Error"
GoTo Obj_Release
End If
 
Hi,

Do you have a reference set to a Attachmate Reflections Object Library in your Excel VBAProject?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hi Skip.
Thank you for looking into this.
Yes I do. Also, i have it installed.
It's already been a week and couldn't resolve this.
 
Hi Skip. Yes, I had all that referenced also but still error is prompting that Active X can't create the object.
 
Use CreateObject() to create the application object.

Caveat:
I am not an Attachmate Reflections user and never have been.

I am a former Attachmate Extra (AE) user. But I have done 99.99% of my AE coding in Excel VBA and I understand object concepts and working asynchronously with a terminal emulator.

If it helps any, here's the code I used to create an Attachmate System object (seems like its the application object...)
Code:
Public oSystem As ExtraSystem
Public oSess As ExtraSession
Public oScrn As ExtraScreen

Sub IMS_Login()

    Dim result, bLogin As Boolean
    
    Set oSystem = CreateObject("Extra.System")
    
    If oSystem.Sessions.Count = 0 Then
        Set oSess = oSystem.Sessions.Open("C:\Program Files\E!PC\Sessions\Mainframe.edp")
    Else
        Set oSess = oSystem.ActiveSession
    End If
    
    With oSess
        .Visible = True
        .WindowState = xNORMAL
    End With

    Set oScrn = oSess.Screen
    If (oScrn Is Nothing) Then GoTo ExitMacro
    
    oSystem.TimeoutValue = 100
    
    With oScrn
        If bLogin Then
        ' BHT SignOn
            Do Until .WaitForCursor(17, 28)
                DoEvents
            Loop
            .Area(17, 28, 17, 28) = "S"
            .SendKeys ("<ENTER>")
        ' Login
            Do Until .WaitForCursor(14, 37)
                DoEvents
            Loop
            .Area(14, 37, 14, 46) = fOSUserName()
            .Area(15, 37, 15, 46) = vPassword
            .SendKeys ("<ENTER>")
        ' SuperSession
            Do Until .WaitForCursor(9, 2)
                DoEvents
            Loop
            .Area(11, 2, 11, 2) = "S"
            .SendKeys ("<ENTER>")
        ' IMS Ready
        End If
    End With

'...Macro Magic happens here...

ExitMacro:
    If bContinue Then Exit Sub
    Set oScrn = Nothing
    Set oSess = Nothing
    Set oSystem = Nothing
End Sub

So for Reflection, maybe this...
Code:
Dim oSess as Reflection.Session
Set oSess= CreateObject("Reflection.Session")


Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thank you Skip for sharing. I also tried this. Using creatobject and getobject approach. But still getting the same error. I also created some macro before using attachmate extra like the one you shared above with no problem. Seems this attacmate reflection is giving me a hard time. I saw last year post with same problem by sharonniles. Am hoping she'found a solution. Would you know how to reach her?
 
Cannot make that contact.

Plz post the code that you tried with CreateObject.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Here it is. As mentioned in the Help files.

Set oApp = CreateObject(Reflection Workspace)
If (oApp Is Nothing) Then
MsgBox "Unable to create Attachmate Workspace Application", vbCritical, "Application Workspace Error"
GoTo Obj_Release
End If
 
Hi,

Hmmmmmmm. Where's Workspace???


Here's what it seems to me. "Workspace" is a display thing, when you're working in Reflection.

However, you have stated that you'r running Excel usung VBA. What do you care what the workspace looks like? You just want to get data to get from Excel to your mainframe and data from your mainframe to Excel.

FORGET WORKSPACE!

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
...and from the Attachmate Reflection Workspace site...
You can customize the Reflection workspace to control its appearance and behavior or to lock down access to Reflection settings and controls.
...none of which, if I understand your intent, will affect data acquisition to or from the mainframe system.


Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hi Skip,

I'm sorry was out for days. but here's what I understand. in order to access the frame I need to get the application itself by doing this.

Set oApp = New Attachmate_Reflection_Objects_Framework.ApplicationObject
or
Set oApp = CreateObject("Reflection Workspace")

however, none of this works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top