Property Let/ Get

gpurger

Registered User.
Local time
Today, 07:01
Joined
Apr 21, 2004
Messages
66
Hi,
I am trying to use the property let command but I do not know how or where to call/ insert it.
I have a list and want another module to use the result.

Code as follows

With UserForm1.ListBox1
.RowSource = ""
.AddItem "Class and Operation data" 'Adds item to the userform list
End With
UserForm1.Show
Call SelectCriteria(iLineNum)

MsgBox iLineNum

End Sub


Property Let Selection(iVal) Where do I put this and how do I call it
iLineNum = iVal
End Property


Sub SelectCriteria(iLineNum)

Sheets("Results").Select

Cells(1, 1).Value = "ClassID"
Cells(1, 2).Value = "Class Name"

Select Case iLineNum

Case 1
sOppCrit = "<Operation Guid="
sClasCrit = "<Class Guid="
Cells(1, 3).Value = "Operation ID"
Cells(1, 4).Value = "Operation Name"

Case 2

Case 3

Case 7
MsgBox "Hello"
Case 99
Cells(1, 1).Value = ""
Cells(1, 2).Value = ""
End Select

End Sub
 
It goes outwith your subroutines and functions

i.e.

Code:
Option Compare Database
Option Explicit

Private mForename As String
Private mSurname As String

Public Property Get prpForename As String
    prpForename = mForename
End Property

Public Property Let prpForename(NewText As String)
    mForename = NewText
End Property

Public Property Get prpSurname As String
    prpSurname = mSurname
End Property

Public Property Let prpSurname(NewText As String)
    mSurname = NewText
End Property

Public Function fExample()
    Dim strForename As String
    Dim strSurname As String   

    strForename = "John"
    strSurname = "Smith"

    MsgBox "Forename Variable: " & strForename & vbCrLf & _
               "Surname Variable: " & strSurname & vbCrLf & _
               "Forename Property: " & Me.prpForename & vbCrLf & _
               "Surname Property: " & Me.prpSurname, vbOkOnly, "Test #1"

    Me.prpForename = strForename
    Me.prpSurname = strSurname

    MsgBox "Forename Variable: " & strForename & vbCrLf & _
               "Surname Variable: " & strSurname & vbCrLf & _
               "Forename Property: " & Me.prpForename & vbCrLf & _
               "Surname Property: " & Me.prpSurname, vbOkOnly, "Test #2"

    strForename = "James"
    strSurname = "Brown"

    MsgBox "Forename Variable: " & strForename & vbCrLf & _
               "Surname Variable: " & strSurname & vbCrLf & _
               "Forename Property: " & Me.prpForename & vbCrLf & _
               "Surname Property: " & Me.prpSurname, vbOkOnly, "Test #3"

    strForename = Me.prpForename
    strSurname = Me.prpSurname

    MsgBox "Forename Variable: " & strForename & vbCrLf & _
               "Surname Variable: " & strSurname & vbCrLf & _
               "Forename Property: " & Me.prpForename & vbCrLf & _
               "Surname Property: " & Me.prpSurname, vbOkOnly, "Test #4"

    strForename = vbNullString
    strSurname = vbNullString

End Function
 
Thanks for that

Gordon
 

Users who are viewing this thread

Back
Top Bottom