Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default referencing at module level

Hi NG

I have a small problem with referencing a public variable in a module

Module A:
public strXML as string

Module B:
sub something
msgbox "String: " & A.strXML
end sub

My problem is that the first time a run the above everything works fine, but
the second time i run it then strXML = "". Like it has been flushed somehow.
I tried it with other objects too, and the same accured.

Does anyone know what is going on and how to fix it?

Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default referencing at module level

Hi Mark,

Module A:
public strXML as string

Module B:
sub something
msgbox "String: " & A.strXML
end sub

My problem is that the first time a run the above everything works fine, but
the second time i run it then strXML = "". Like it has been flushed somehow.
I tried it with other objects too, and the same accured.


Does your code contain any End statement?

Also, AFAIK you don't need the A. prefix before the variable name. Unless
another module also contains a variable by that name, which makes declaring
that variable as public illogical in the first place.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
Why, when I create workbook-level name does it jump it to Sheet-level ? Charles Jordan Excel Programming 1 November 5th 03 08:43 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
module-level variable lifetime Jessie[_2_] Excel Programming 0 July 30th 03 09:31 PM


All times are GMT +1. The time now is 05:55 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"