Right now I am trying to automate the building of a form that needs data collection from multiple sources. This is a question that will influence my design so no code is available for reference yet.
General setup
In a module "Module1"
Public infoArray As Variant
Sub Main()
'info array initialized to some value here
'insert various lines of code here
formA.show (vbModeless)
End Sub
Sub afterComments()
'called by an action done in the modeless FormA
'insert code that accesses infoArray() here
End Sub
My question: If a variable is declared as public in a module, so that it exists outside the bounds of a subroutine, and a modeless form is called before the main subroutine ends. Will the value for that variable, set in the main subroutine, be available for the "afterComments" subroutine to access? Since the main subroutine will continue to its end because the form is modeless, I do not know if the values for those public variables will be cleared once that happens, or remain in memory since a form is still technically active.
(yes I realize I could probably find out quickly by running a test piece of code, but i don't have access to excel right now and I need to continue designing, also I apologize for the formating and any typos, this was written from my phone.)
So far I've only been able to find info on modeless form implementation, public variable access rules and that public variables are cleared when the code stops running, I just don't know if this counts as the code finishing or not because while the main subroutine finishes execution, the modeless form is still active. A simple yes or know would be sufficient, but any help would be greatly appreciated.