Hi Stefan,
Thank you for the reply but the adjustment in code did not help. My old code and your edited version is still having the same error in picking the correct system. The code works if all sap systems are open and runs on the correct system (old code), what I need is it will display an error if the sap system is not open. But what It does is run the VBA into the wrong system and displays the error. It shouldstop VBA from executing if the correct SAP system is not open.
Thanks,
Harris