Can you access public variables in a different worksheet?

K

Kalen Brunham

Does anyone know if it is somehow possible to access VBA variables declared
as public in an excel workbook from a different workbook?

For example, workbook1 has

public test as integer

in module1 of the VBAProject.

From a different workbook can I access it something like:

Workbooks(1).module1.test

Thanks.
 
S

Stephen Bullen

Hi Kalen,
Does anyone know if it is somehow possible to access VBA variables declared
as public in an excel workbook from a different workbook?

For example, workbook1 has

public test as integer

in module1 of the VBAProject.

From a different workbook can I access it something like:

Workbooks(1).module1.test

If you use Tools > References to create a reference from one book to the
other, all the public variables declared in the referenced workbook can be
seen in the referencing workbook too.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

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