Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps the usage of public variables is confusing the OP. The rule of
thumb is too to minimize scoping and public variables aren't required in this scenario e.g. ' ---<Userform2 code module--- Option Explicit Private m_strMyArray() As String Private Sub UserForm_Activate() LoadArray End Sub Sub LoadArray() ReDim m_strMyArray(2) m_strMyArray(0) = "No" m_strMyArray(1) = "Public" m_strMyArray(2) = "Variables" End Sub Public Property Get MyArray() As Variant MyArray = m_strMyArray End Property Private Sub UserForm_QueryClose( _ Cancel As Integer, _ CloseMode As Integer) Me.Hide Cancel = True End Sub ' ---</Userform2 code module--- ' ---<Userform1 code module--- Option Explicit Private Sub UserForm_Click() Dim TestArray() As String Dim frm1 As UserForm2 Set frm1 = New UserForm2 With frm1 .Show vbModal TestArray = .MyArray End With ' Do things with TestArray here ... MsgBox TestArray(0) & _ " " & TestArray(1) & _ " " & TestArray(2) ' ... or use a Property to make it ' available to other procedures End Sub ' ---</Userform1 code module--- Jamie. -- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
public variables | Excel Discussion (Misc queries) | |||
Public variables | Excel Discussion (Misc queries) | |||
Public Variables | Excel Discussion (Misc queries) | |||
Public Variables | Excel Programming | |||
Public Variables with UserForms | Excel Programming |