Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between variables declared using Global and variables declared using Public?

0
10 Posted

Whats the difference between variables declared using Global and variables declared using Public?

0
10

Nothing. Global is included with VBA for compatibility with other versions of Basic. Public is preferred, but using Global does exactly the same thing. I’m confused over the Public keyword. According to the Visual Basic User’s Guide: “Variables declared using the Public statement are available to all procedures in all modules in all applications unless Option Private Module is in effect; in which case, the variables are Public only within the project in which they reside.” This does not seem to be the case. Why? For this to work, you must use the Tools References command (available only in VBA modules) to register the workbook that contains the reference you want to use. I’m having trouble using SendKeys to send a left bracket ({) or a right bracket (}). It tells me there’s an invalid procedure call. This was a known bug in Excel 5, and it hasn’t been fixed in Excel 95.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123