Hi, I have the following problem: I would like to bring a newly crearted workbook to the foreground after the code is finished.

Based on some research, the following works for me normally: AppActivate book.Windows(1).Caption

I don't know whether this is related to me using a split/extended desktop with 2 monitors, but I encountered the problem that this only works if the Excel instance/workbook from which the code is run, is on a different monitor than the VBE.
Only in this case the new workbook is brought to the foreground (on the non-VBE mointor) after the code is finished.
It works for either monitor, i.e. is not dependant on which monitor the VBE and the excel instance respectively are.

If the workbook from which the code is run and the VBE are on the same monitor, the code fails and the new window is not brought to the foreground.

Does anyone have a solution for this?

Also, is there a way to say to which monitor to bring the new workbook to the foreground?

Thanks