Frank Melan
Technical User
I have searched the internet & have found how to use Attachmate to do stuff in excel, but nothing to open a file. The code I have so far acts like it is going to open, then hangs up on ActiveWorkbook.FollowHyperlink MyFolder. I also get the following error: Run-time error '-2147417851 (80010105), an unexpected error has occurred. I am using excel 2010, with an active x control. I have tried several variations of code, but this is the furthest, that I have gotten. Could you please let me know what I am doing wrong & how to correct it. I have reached out to another coder at work, & he is as stumped as I am. Here is the current code:
I have edit the code that you provided. Here is the current code, I have highlighted the line it hangs on:
Code:
Sub VISTA()
Dim Msg As String, Ans As Variant
Msg = "Would you like to open VISTA?"
Ans = MsgBox(Msg, vbYesNo)
Select Case Ans
Case vbYes
Dim MyFolder As String
MyFolder = "C:\ProgramData\Attachmate\Reflection\R04-reflection.r2w"
ActiveWorkbook.FollowHyperlink MyFolder
End Select
End Sub
Code:
Sub VISTA()
Dim Msg As String, Ans As Variant
Msg = "Would you like to open VISTA?"
Ans = MsgBox(Msg, vbYesNo)
Select Case Ans
Case vbYes
'
Set oSystem = CreateObject("Reflection.System")
If oSystem.Sessions.Count = 0 Then
Set oSess = oSystem.Sessions.Open("C:\ProgramData\Attachmate\Reflection\R04-reflection.r2w")
Else
Set oSess = oSystem.ActiveSession
End If
With oSess
.Visible = True
.WindowState = xNORMAL
End With
Set oScrn = oSess.Screen
[highlight #CC0000] If (oScrn Is Nothing) Then GoTo Exit Macro[/highlight]
With oScrn
.Area(17, 28, 17, 28) = "S"
.SendKeys ("<ENTER>")
Do Until .WaitForCursor(14, 37)
DoEvents
Loop
End With
'Dim MyFolder As String
'MyFolder = "C:\ProgramData\Attachmate\Reflection\R04-reflection.r2w"
'ActiveWorkbook.FollowHyperlink MyFolder
End Select
End Sub