I have a few questions about how global variables can be used in Excel VBA.
So my application uses an API object that's provided by a third party. Currently in all of the functions, we initialize this object and use it:
function()
Dim api as someApi
api.dosth
end function
I'm just wondering, instead of initialize it every single time, can i just make it a global variable? like just declare it at the beginning and initialize it in the workbook_open function? If multiple functions are running at the same time and trying to use this shared api object, will it be a problem? Also just a general question about global variables: do all the modules share the variables? Or each module can only see the global variables declared in its own code? For example if I have module a and module b in the same workbook, and api object is declared in module a and initialized in the workbook_open event, can the functions in module b use it or not?
Thanks so much!!