View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 10
Default how to declare a class module

Bob,
The methods to declaring a class in a different project
appear to be different. Can you offer the steps in which
I might declare a class in one XLA so that it is visible
in the other XLA in a particular instance of Excel. For
example, I want to put all my Class Modules into it's own
XLA so I can password it from the other developers on the
team. I'm having trouble accessing the procedures in the
other modules class <Object variable or With Block not
set.

Project 1 (Classes.xla) is loaded into Session X of Excel
Project 2 (Program.xla) is loaded into Session X of Excel

I want to access the 'Public Property Get LEISUserName'
from program.xla but I'm having no success. Any thoughts?
-Kevin


-----Original Message-----
Kevin,

You don't say what is happening, and VB and VBA declare

class properties and
methods in a similar way.

One thing I note though. VBA does not have an App object,

so you will get an
error on that. You will need to code the productname in.

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Kevin" wrote in message
...
I've been programming in VB6 for a while but it seems

that
how you declare the properties, methods, and events of a
class module in Excel VBA is different.

I've declared several public properties in a a class
module. Now I want to set these properties from a form
module. What am I doing wrong?

Code excerpt from Class Module (PGDSettings):
'LEIS User Name Start - Public
Public Property Get LEISUserName() As String
LEISUserName = GetSetting
(App.ProductName, "Settings", "LEISUUID")
End Property
Public Property Let LEISUserName(strLEISUserName As

String)
SaveSetting App.ProductName, "Settings", "LEISUUID",
strLEISUserName
End Property
'LEIS User Name End

Code excerpt from Form Module:
Option Explicit
Public ps As New PGDSettings
Private Sub UserForm_Activate()
txtUuid.Text = ps.LEISUserName
End Sub



.