I am trying to use a variable already declared in a workbook module, in a second workbook.
In the first workbook module I write:
I can verify in the inspection window that StrA has the correct value after running SetString.
However, when I run the following in the second workbook module:
I find StrA is empty. I have tried to qualify StrA with the project and modules names, but I get errors stating that an object is needed.
The project name is "VBAProject" in both modules. Shouldn't the PUBLIC declaration allow me to share the variable ?
Thanks for any help !
In the first workbook module I write:
Code:
Public StrA As String
Sub SetString()
StrA = "abc"
MsgBox StrA
End Sub
I can verify in the inspection window that StrA has the correct value after running SetString.
However, when I run the following in the second workbook module:
Code:
Sub ShowStr()
MsgBox StrA
End Sub
I find StrA is empty. I have tried to qualify StrA with the project and modules names, but I get errors stating that an object is needed.
The project name is "VBAProject" in both modules. Shouldn't the PUBLIC declaration allow me to share the variable ?
Thanks for any help !