Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"