Trying to clean up my code by creating the objects of SAP in it’s own sub?

I have dozens of small functions, and before each I have to do something like the code below. Is it possible to write this only once somewhere in my code and call it every time I need it? If Not IsObject(SAPapplication) Then Set SapGuiAuto = GetObject(“SAPGUI”) Set SAPapplication = SapGuiAuto.GetScriptingEngine End If If Not IsObject(Connection) […]