AlmostVinDiesel
New Member
- Joined
- Oct 26, 2005
- Messages
- 18
I'm having a problem with Excel VBA and Classes. I can't get the member variables to store any information. Can anyone help please? Code is below:
'Class Module: Campaign
'-------------------------------------------------------------------------------------
Private pCampaign As String
Public Property Get Campaign() As String
Campaign = pCampaign
End Property
Public Property Let Campaign(s As String)
pCampaign = s
End Property
'-------------------------------------------------------------------------------------
'Regular Module
Sub Test()
Dim record As Campaign
Set record = New Campaign
record.Campaign = "test"
Range(Cells(1, 1), Cells(1, 1)) = record.Campaign 'But nothing is stored!
End Sub
'Nothing is stored in the Cell A1. Can anyone help?
Thanks!
~John
'Class Module: Campaign
'-------------------------------------------------------------------------------------
Private pCampaign As String
Public Property Get Campaign() As String
Campaign = pCampaign
End Property
Public Property Let Campaign(s As String)
pCampaign = s
End Property
'-------------------------------------------------------------------------------------
'Regular Module
Sub Test()
Dim record As Campaign
Set record = New Campaign
record.Campaign = "test"
Range(Cells(1, 1), Cells(1, 1)) = record.Campaign 'But nothing is stored!
End Sub
'Nothing is stored in the Cell A1. Can anyone help?
Thanks!
~John