Macro Running issue-Runtime error 91

Hi Team,

I’m facing issue in Executing the Macro.

I’ve logged into the terminal session in Init all applications and passed the conn str wherever required.
Once I execute the macro using Run spreadsheet Macro activity, it will connect to Mainframe(terminal) and perform some data extraction and pull up the details in the same excel. But I’m getting runtime 91 error while executing the macro
If I reboot the machine then first run works fine and then issue starts happening.

I have tried below troubleshooting methods before the macro execution,

  1. kill all process for killing excel
  2. Activating mainframe screen
  3. Re-login to Mainframe application

Please help in solving the issue!

Hi @Soundharya,
Have you tried with different macro code and check if the issue still persist.

Just try with new macro and do some simple step.

Regards,
Firoz

Thanks for responding @FIROZ_RANGREZ

I have tried with different excel macro file, which will perform some action in Mainframe application. I have observed the same behavior of issue with this macro file.

I’ve debugged the macro code once after the error received. In the coding, they are checking the active session of the mainframe before proceeding with the data extraction, there the session variable returns nothing when the issue happens. For that, I’ve tried activating the mainframe window and re-login to mainframe application before the macro execution, Still the issue occurs… Please help!

Hi @Soundharya,

By just reading I can’t assume what is happening in macro.

is it possible to share the small part of code where you are facing the issue so that I can check from my side.

or maybe some helpfull screenshots which can indicate the error and the scenarios which you are mentioning.

Regards,
Firoz

In the macro, it is written like below
Set System=CreateObject(“Extra.System”)
Set ses1=System.ActiveSession
Trynow:
if ses1.screen.getstring(1,2,3)=“Lock” Then
///Perform Some action////

I’m getting error in the above If condition as the session value is returning nothing