Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to keep values in classmodules
I have
Module modtest Classmodule clsTest modtest.FirstCall Sub FirstCall StoreValue = 1 Debug.print StoreValue End sub modtest.SeondCall Sub secondCall Debug.print StoreValue End sub in clsTest I have: Proberty Let StoreValue (newvalue as integer) m_storeValue = newvalue End property Proberty Get StoreValue (newvalue as integer) StoreValue = m_storeValue End property What ever I tried in modTest second call StoreValue in modtest.SeondCall always has been 0 Is there any help how to Dim m_storeValue in the Classmodule using static, so that modtest.SeondCall has the same value as in FirstCall Thanks for help. Gottfried |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to keep values in classmodules
Gottfried,
Here is one way to set up your modules. Module modTest ---------------------------------------------------------------- Option Explicit Dim cls As New clsTest Sub FirstCall() cls.StoreValue = 1 Debug.Print cls.StoreValue End Sub Sub SecondCall() Debug.Print cls.StoreValue End Sub ----------------------------------------------------------------- Class Module clsTest ----------------------------------------------------------------- Option Explicit Private m_storeValue As Integer Property Let StoreValue(newvalue As Integer) m_storeValue = newvalue End Property Property Get StoreValue() As Integer StoreValue = m_storeValue End Property ------------------------------------------------------------------ -- John Green - Excel MVP Sydney Australia "Gottfried Ehmann" wrote in message ... I have Module modtest Classmodule clsTest modtest.FirstCall Sub FirstCall StoreValue = 1 Debug.print StoreValue End sub modtest.SeondCall Sub secondCall Debug.print StoreValue End sub in clsTest I have: Proberty Let StoreValue (newvalue as integer) m_storeValue = newvalue End property Proberty Get StoreValue (newvalue as integer) StoreValue = m_storeValue End property What ever I tried in modTest second call StoreValue in modtest.SeondCall always has been 0 Is there any help how to Dim m_storeValue in the Classmodule using static, so that modtest.SeondCall has the same value as in FirstCall Thanks for help. Gottfried |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to keep values in classmodules
Thanks John,
I tried everything but putting 'Dim clslz As New clsTest' on module level instead of procedure level Tanks again Gottfried |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? | Excel Discussion (Misc queries) | |||
Excel 2007 doesnt show Y-axis values when the values are small. | Charts and Charting in Excel | |||
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row | Excel Worksheet Functions | |||
Adding numerical values based on multiple values in another column | Excel Worksheet Functions | |||
create list of unique values from a column with repeated values? | Excel Worksheet Functions |