View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
moonhk moonhk is offline
external usenet poster
 
Posts: 62
Default Public variable problem

I neet below error "Method or Data member not found" , when put "Public
cim As New clsCIM" into Global_public module. Other two public variable
gerr_cnt and gShErr are OK.

How to handle class level public variable ?

Option Explicit
'~~ Module : Global_Public
Public gerr_Cnt As Long
Public gShErr As Worksheet
Public cim As New clsCIM


moonhk wrote:
Thank, I try using a seperate module to hold global variable. I am sure
that do not have 'Option Private Module'.

Martin Fishlock wrote:
Dear Moonhk,

You only need to declare one instance of the public variables I usually have
a seperate module tohold 'global publics'.

You need to ensure that you do not have 'Option Private Module' is in effect.

You can then access these variable in every module, unless you actually want
seperate instances of the variable for each module.

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"moonhk" wrote:

I have nine module 1 to module 9. Each module handle one location of
Voucher.
How to define following two public variable ? Need to define in each
module ?

Public gerr_Cnt As Long
Public gShErr As Worksheet


Module 1
Option Explicit
'~~ 2006/11/24
Public gcJap As New clsConfigJap
Public gerr_Cnt As Long
Public gShErr As Worksheet

Sub Voucher_JAP_Step_1()
.....
end

Module 2
Option Explicit

Public gcSin As New clsConfigSin
Public gerr_Cnt As Long
Public gShErr As Worksheet

Sub Voucher_SIN_Step_1()
.....
end