how to declare a class module

K

Kevin

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
 
K

Kevin

Scratch it. I figured out what was wrong. I was using
the app.productname which works in VB6 but not in Excel
VBA. Replaced it and it works fine. Sorry to have bugged
anyone.
-Kevin
 
K

Kevin

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
 
K

kevin

I've tried doing that but I always get the DLL entry point
not found error. Could never get around it. I also don't
want to worry about the DLL having to get published to
every PC. Classes in and XLA are embedded, right? Or is
there some other wayt to do the same with a DLL...embed it
into the XLA?
 
K

kevin

The hack you suggested works great! I'll consider your
warnings about it not being supported but for the time
being...I got it working. I should also mention, I found
your hack also documented in the QUE Special Edition of
Using Excel Visual Basic - Chapter 2.
Thanks!
Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top