LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Accessing Public variable in different modules

I'm having trouble accessing a public variable in a module when this
public variable is declared in another module. Here's my situation
where I have 2 forms and 2 modules:

form1

form2

module1
Public TWB As Object
load form1 ' works fine

module2
load form2 ' TWB is Nothing

The TWB public variable is Set in the Auto_Open() (actually in another
module) so it is always set.

Both form1 and form2 reference TWB in their form initialization but
TWB shows up as set to Nothing when form2 is loaded in module2.
However, if I move the Public statement from module1 to module2 then
loading form2 works fine.

So what am I doing wrong? Supposedly public variables are accessible
across all modules in the same project and I'm not using any 'option
private module.'

Denis

 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public variable Eric[_35_] Excel Programming 7 March 18th 07 06:54 AM
Public, Private, Event modules, Forms modules,,, Jim May Excel Programming 11 October 31st 05 03:12 AM
Problem accessing Oracle Public Synonyms from Microsoft Excel 2002 Sandeep Excel Discussion (Misc queries) 1 January 5th 05 09:31 AM
Public Variable Jason Excel Programming 4 April 12th 04 07:06 PM
Accessing AddIn Class Modules from Client Worksheet Mark D'Agosta Excel Programming 0 October 9th 03 04:43 PM


All times are GMT +1. The time now is 12:31 AM.

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

About Us

"It's about Microsoft Excel"