ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Public Variables (https://www.excelbanter.com/excel-programming/316171-public-variables.html)

Les Gordon

Public Variables
 
I have declared two Public variables to track various data. Eveything works
well until the systme crashes (in this case, which I will fix, because the
suggesated sheetname has more than 31 characters). Once it crashes the Public
variables loose their values and can't be reset; closing the workbook doesn't
help but restarting Excel does. Is this a scope problem; can I fix it in code?

Regards
--
Les Gordon

Tom Ogilvy

Public Variables
 
Generally, you code should be designed not to crash, so this shouldn't be an
issue in a working app.

Running the code that originally set the values for the variables should
work again after the crash (if you hit the reset button in the VBE).

--
Regards,
Tom Ogilvy

"Les Gordon" wrote in message
...
I have declared two Public variables to track various data. Eveything

works
well until the systme crashes (in this case, which I will fix, because the
suggesated sheetname has more than 31 characters). Once it crashes the

Public
variables loose their values and can't be reset; closing the workbook

doesn't
help but restarting Excel does. Is this a scope problem; can I fix it in

code?

Regards
--
Les Gordon




Les Gordon

Public Variables
 
Thanks Tom

I agree competely, but it did; my fault in this case in that I didn't
realize that sheet names had these restrictions; generally I have error
trapping and this isn't a problem.

However, the reset doesn't solve the dilemma in this case. The Public
variables just refuse to take new values; the don't re-initilailize. I trace
the values and they exist all the way through and then dissappear at the end
of the function. I can't get them to stick until I restart Excel.

It's a bit frustrating during a debugging phase.

Regards

Les

"Tom Ogilvy" wrote:

Generally, you code should be designed not to crash, so this shouldn't be an
issue in a working app.

Running the code that originally set the values for the variables should
work again after the crash (if you hit the reset button in the VBE).

--
Regards,
Tom Ogilvy

"Les Gordon" wrote in message
...
I have declared two Public variables to track various data. Eveything

works
well until the systme crashes (in this case, which I will fix, because the
suggesated sheetname has more than 31 characters). Once it crashes the

Public
variables loose their values and can't be reset; closing the workbook

doesn't
help but restarting Excel does. Is this a scope problem; can I fix it in

code?

Regards
--
Les Gordon






All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com