AndrewGKenneth
Board Regular
- Joined
- Aug 6, 2018
- Messages
- 59
Dear all,
Thanks in advance for your help. I am having a slight issue with my code below. What I am hoping to achieve with this code is that the user enters their details into a userform (Employee Number and Password) and then they are taken to their own workbook and the current workbook is closed. This is working fine, apart from when the user has another document open on their computer. The problem I am having is that the file (in this case "10018 - Assembly") is not showing as the activeworkbook if the user has another file open on their computer. Instead, whatever file they may have open is showing as the activeworkbook despite my code. . I really need the (10018 - Assembly) file to be activated. Any suggestions on how to fix this?
Application.ScreenUpdating = True
If TextBox_EmployeeNumber.Value = "10018" And Textbox_Password.Value = "190453" Then
Workbooks.Open Filename:="X:\Drawing - Pricing\Absence Data\10018 - Assembly.xlsm"
Workbooks("10018 - Assembly.xlsm").Activate
ThisWorkbook.Close SaveChanges:=True
Unload Me
End If
Application.ScreenUpdating = False
End Sub
Thanks in advance for your help. I am having a slight issue with my code below. What I am hoping to achieve with this code is that the user enters their details into a userform (Employee Number and Password) and then they are taken to their own workbook and the current workbook is closed. This is working fine, apart from when the user has another document open on their computer. The problem I am having is that the file (in this case "10018 - Assembly") is not showing as the activeworkbook if the user has another file open on their computer. Instead, whatever file they may have open is showing as the activeworkbook despite my code. . I really need the (10018 - Assembly) file to be activated. Any suggestions on how to fix this?
Application.ScreenUpdating = True
If TextBox_EmployeeNumber.Value = "10018" And Textbox_Password.Value = "190453" Then
Workbooks.Open Filename:="X:\Drawing - Pricing\Absence Data\10018 - Assembly.xlsm"
Workbooks("10018 - Assembly.xlsm").Activate
ThisWorkbook.Close SaveChanges:=True
Unload Me
End If
Application.ScreenUpdating = False
End Sub