I have two commands of Application.CommandBars("Workbook Tabs").ShowPopup in my code. The first code works fine but the second code does not. The first command and the second command are doing the same thing, just showing workbook tab popup of a different worksheet.
I've added a 10 second pause between the first command and second command. I've also put the second command into a different module, calling it from the first module. I've also separated the first command in one sub and the second command into a different sub.
Sub Test()
Dim wbkA As String
Dim wbkB As String
Workbooks("Test.xlsm").Activate
wbkA = Range("B8")
wbkB = Range("B7")
Workbooks(wbkA).Activate
Application.CommandBars("Workbook Tabs").ShowPopup
Set ws1 = ActiveSheet
ActiveSheet.Move Before:=ActiveWorkbook.Sheets(1)
Workbooks(wbkB).Activate
Application.CommandBars("Workbook Tabs").ShowPopup
Set ws2 = ActiveSheet
ActiveSheet.Move Before:=ActiveWorkbook.Sheets(1)
End Sub
If you run the code one by one by pressing F8 in the debugger mode, it succeeds.
I expect not to get the debugger window and the code should run smoothly.