I\'m using VBA for Excel. From my understanding, global variables need to be declared outside of any subs. That\'s the only way they can be accessed by all subs.
At th
Global variables are really not needed and should be avoided. However, if you have decided to use them for a your own reasons, you can put them in the Workbook_Open
event:
Option Explicit
Dim Dic1 As Object
Dim Dic2 As Object
Private Sub Workbook_Open()
Set Dic1 = CreateObject("Scripting.Dictionary")
Set Dic2 = CreateObject("Scripting.Dictionary")
End Sub
Thus, it would create the object every time the workbook is opened.