Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to open a userform in one workbook from an event in my main code holding workbook.
From a click of an object in workbook1
!macro_01 is accessed in workbook2 (wb_rd).
Declarations is a module (in workbook2) where all my worksheets for workbook2 are defined publically, and quite a bit in the application of userform 'group_1'.
MRI is a value used to flag a certain procedure in the initialization of the userform 'group_1'
The problem I am having, is I'm unable to maintain the value of MRI. In macro_01 it is set to true, but when it reaches the Declarations module, it's false.
What can I do to maintain this variable's value? I though defining it as public would do it. Maybe I'm not declaring it in the right place?
From a click of an object in workbook1
Code:
Private Sub lb_cntmissp_Click()
If lb_cntmissp.Caption = "0" Then Exit Sub
With wb_rd
Application.Run wb_rd.Name & "!macro_01"
End With
End Sub
Code:
Public mri As Boolean
Sub macro_01()
mri = True
MsgBox "MRI: " & mri
declarations_1
'group_1.Show
End Sub
Declarations is a module (in workbook2) where all my worksheets for workbook2 are defined publically, and quite a bit in the application of userform 'group_1'.
MRI is a value used to flag a certain procedure in the initialization of the userform 'group_1'
Code:
Public mbevents As Boolean
Public ws_rd As Worksheet
Public ws_rm As Worksheet
Public ws_amm As Worksheet
Public ws_lists As Worksheet
Public ws_Cust As Worksheet
Public ws_group As Worksheet
Public ws_vh As Worksheet
Public pn As Long
Public CH, df1 As Integer
'Public mri As Boolean
Sub declarations_1()
Set wb_rd = Workbooks("Rental_Detail.xlsm")
Set ws_rd = wb_rd.Worksheets("Rental_Data")
Set ws_rm = wb_rd.Worksheets("Rental_Main")
Set ws_amm = wb_rd.Worksheets("Ammendments")
Set ws_lists = wb_rd.Worksheets("LISTS")
Set ws_Cust = wb_rd.Worksheets("Customer_Default")
Set ws_group = wb_rd.Worksheets("Group_Defaults")
Set ws_vh = wb_rd.Worksheets("VAR_HOLD")
group_1.Show
End Sub
The problem I am having, is I'm unable to maintain the value of MRI. In macro_01 it is set to true, but when it reaches the Declarations module, it's false.
What can I do to maintain this variable's value? I though defining it as public would do it. Maybe I'm not declaring it in the right place?
Last edited: