Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FAO : Bob Flannagan
Many thanks for your help yesterday. However my global
variable is defined in a standard module, but i keep on losing it. I cant see anywhere in my code apart from where i open the file, with global variable as fname, where this variable is used. Any other ideas. Nathan. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FAO : Bob Flannagan
Nath,
Whereas you may have asked only 1 question, Bob may have answered several. How would he know what you're talking about? Stay in original thread, and your reply to his answer will be flagged, and can be easily traced by Bob. keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Nath" wrote: Many thanks for your help yesterday. However my global variable is defined in a standard module, but i keep on losing it. I cant see anywhere in my code apart from where i open the file, with global variable as fname, where this variable is used. Any other ideas. Nathan. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Bob Flannagan
Nathan, if you execute the statement:
End all by itself to halt your macros, it resets all global varaibles. Also, vb crashes tend to reset global variables. When you say that you declared it a global variable, exactly what was the declaration? Was the prefix "public" or "global"? It should be Public. I have found that Global isn't always global. Do you have "Option Explicit" set at the top of each module? This forces variables to be declared and you may have a typo this will help catch. If you have also declared the same variable as part of a procedure, that declaration takes precedent over global declarations. So you may be seeing a local variable versus the global one. Lastly, what is telling you that it is reset? Have you tried putting a breakpoint on the global variable, have it set so it is active in all modules and all procedures, and breaks whenever the value changes? This will trap when the value is set and when something else changes it. Bob Flanagan Macro Systems Delaware, U.S. 302-234-9857 http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Nath" wrote in message ... Many thanks for your help yesterday. However my global variable is defined in a standard module, but i keep on losing it. I cant see anywhere in my code apart from where i open the file, with global variable as fname, where this variable is used. Any other ideas. Nathan. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|