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

When remove the Public cim As New clsCIM in CIM module

But Excel return "Method or Data member not found"

NickHK wrote:
The type of "cim" needs to match the name of the class.
So call the module "clsCIM".

Not sure what you are trying to do here :
'~~ Module : CIM
.......
'This line
Public cim As New clsCIM

as you already have the same in the "~~ Modules : Global_Public".

NickHK

"moonhk" wrote in message
oups.com...
Not Yet. still need define "Public cim As New clsCIM" in CIM module.



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

'~~ Module : CIM
Option Explicit
'~~ 2006/11/23 Add SIN
'~~ 2006/11/22
'~~ 2006/11/17
'~~ 2006/11/14

Public cim As New clsCIM



Martin Fishlock wrote:
Hi moonhk

Have you solved the problem?

Have you got the class module included in the project.

I defined a class module and it worked for me. Is the class spelt

correctly?


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


"moonhk" wrote:

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