MistakesWereMade
Board Regular
- Joined
- May 22, 2019
- Messages
- 103
I have a workbook that opens another workbook. Can I control the caption on a label using a separate workbook that is running all my code? Below is my code... but I have an error in the last line.
Code:
Private Sub CommandButton1_Click()
Dim Wbk1 As Workbook
Dim Pth1 As String
Dim OpeningVar1 As String
Pth1 = Environ("Userprofile") & "\Desktop\HT\"
OpeningVar1 = "36MN.xlsx"
Set Wbk1 = Workbooks.Open(Pth1 & OpeningVar1)
If Application.CommandBars("Ribbon").Height <= 150 Then
CommandBars.ExecuteMso "HideRibbon"
End If
Workbook("36MN.xlsx").Label3.Caption = Empl
End Sub