Hello experts,
not sure why this doesn't work but I want to activate a Worbook that I opened via form after the form closes but it doesn't do anything.
My Code
What's weird that Workbooks(CName).Activate doesn't work but MsgBox CName does display the Name of the Woorkbook.
Thank youu
not sure why this doesn't work but I want to activate a Worbook that I opened via form after the form closes but it doesn't do anything.
My Code
Code:
Private Sub OpenButton_Click()
Dim CName As String
If Country.Value = "Abu Dhabi" Then CName = "C:\IC\Intercompany Recs Middle East.xlsb"
On Error GoTo Konec
If ReadOnly.Value = True Then Workbooks.Open filename:=CName, UpdateLinks:=False, ReadOnly:=True Else Workbooks.Open filename:=CName, UpdateLinks:=False
CName = ActiveWorkbook.Name
Konec:
Unload Me
Workbooks(CName).Activate
MsgBox CName
End Sub
What's weird that Workbooks(CName).Activate doesn't work but MsgBox CName does display the Name of the Woorkbook.
Thank youu