About Workbook level declarations?

V

VanS

Hello,
Trying to meet deadline but couldn't find anything in MS documentation re
making variable declarations at the Workbook level under ThisWorkbook. If I
make such a variable declaration there with Option Explicit and Public, will
it be available to all Worksheets and modules code? I created a boolean such
var and one worksheet code module recognized it but another cried "Variable
Not Defined".
I was trying to avoid putting it into a code module if possible.
Thanks, God bless
Van
 
C

Chip Pearson

If you put a Public variable in the ThisWorkbook module, you must
refer to it with the ThisWorkbook qualifier. E.g,

Result = ThisWorkbook.MyVariable



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top