Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public variables and Class

I've got a logit function in a class

<snip

Write #FileNumber, lLogNum, sLogText

<snip

lLogNum is a number that increments every time the method is called

oLog.Log "Test"

lLogNum has a scope of Public

Now in the log file I get
1. test
2. test

However when I instantiate the class in a new module, lLogNume resets itself,
and I get
1. test
2. test

When what I need is
3. test
4. test

Any ideas?

Cheers

Aidy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Public variables and Class

Instantiating a class creates a new instance of that object, so in effect
you have a new iLogNum.


What you need to do is to declare iLogNum as a public variable in a standard
code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Aidy" wrote in message
om...
I've got a logit function in a class

<snip

Write #FileNumber, lLogNum, sLogText

<snip

lLogNum is a number that increments every time the method is called

oLog.Log "Test"

lLogNum has a scope of Public

Now in the log file I get
1. test
2. test

However when I instantiate the class in a new module, lLogNume resets

itself,
and I get
1. test
2. test

When what I need is
3. test
4. test

Any ideas?

Cheers

Aidy



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
Declare and Set Public variables jlclyde Excel Discussion (Misc queries) 2 January 28th 09 02:16 PM
public variables johnny Excel Discussion (Misc queries) 7 February 27th 08 03:44 PM
Public variables johnny Excel Discussion (Misc queries) 2 February 24th 08 05:05 AM
Public Variables Jerry McNabb Excel Discussion (Misc queries) 0 February 24th 08 01:26 AM
Public Variables with UserForms Mark Worthington Excel Programming 3 February 26th 04 12:26 AM


All times are GMT +1. The time now is 03:28 AM.

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"