View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Passing data to an event handler

Thank you for your prompt reply that reassured me that Public
variables work as I expected. I confirmed this by coding up a simple
test case.

Looking at my code more closely, I noticed in the event handler
Worksheet_BeforeDoubleClick the statement

Dim bref as Budget

Now, I realize this created a new local variable. Commenting out
this statement and using bref gives me the Public variable defined
in Main and thus access to the Budget data structure.

If this simple coding error had occurred in another module, I
probably would have quickly spotted it. However, having the error
only occur in an event handler led to the false assumption that
perhaps Excel's event handlers have special rules. Their interface
parameters are specified by Excel and must not be changed, but that
is all.


Glad you caught the problem! Best wishes...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion