I'm trying to hide Excel during a long script in which I do some web-scraping. I'm able to hide the application just fine, the problem is that when I change .Visible back to True, I'm getting 1-2 more additional applications (just empty Excel shells). I'm guessing one of these are my PERSONAL.xlsb workbook, but I'm not sure what the other one is - sometimes I get one extra, sometimes I get two. The only way I can close these shell files is by ending the EXCEL.EXE process via task manager.
I've tried hiding just the main window (Windows(1)) as well to no avail (it just hides the workbook, not the application):
Sub Test()
Windows(ThisWorkbook.Name).Visible = False
Application.Wait (Now + TimeValue("0:00:05"))
Windows(ThisWorkbook.Name).Visible = True
End Sub
How can I just have my main workbook re-appear?
Sample code:
Sub Test()
Application.Visible = False
Application.Wait (Now + TimeValue("0:00:05"))
Application.Visible = True
End Sub
Edit: This is on Windows 7, Excel 2016
Edit2: Running just Application.Visible = True by itself also gives me these two phantom applications.
Edit3: The issue definitely has to do with having macros stored in the PERSONAL.xlsb file - when I go onto a fresh computer and add a new macro to this workbook, I can reproduce the issue. However, I'm still not sure how to avoid it...
Task manager:
The script that opens Excel from Filemaker Pro:
Open URL [With dialog:Off; "C:\Users\Username\Desktop\TestFile.xlsm"]
Inside TestFile.xlsm:
Private Sub Workbook_Open()
Application.Visible = False
'Refresh a query in the Excel workbook that is linked to Filemaker Pro
'Webscrape, webscrape, webscrape from a worksheet inside this Excel document
'to a hidden Internet Explorer Window (ewww, IE!)
Application.Wait (Now + TimeValue("0:00:05"))
Application.Visible = True
'Either close Excel completely or reload my main instance of Excel
End Sub
I've realized that I can just completely quit Excel with Excel.Application.Quit, but I haven't decided if I want to exit out right away, or repaint a UserForm in Excel that summarizes the import process

