Here's a code snipped exemplifying the issue I'm having:
Private Sub document_open()
Dim excelObj As Excel.Application
Err.Clear 'just pro forma, in case there's any previous junk left
On Error Resume Next
Set excelObj = GetObject("Book1").Application
excelObj.Visible = True 'not necessary, I guess but I left it there anyway, tried removing it, tried changing it to false - no difference
MsgBox excelObj Is Nothing 'for testing purposes
End Sub
I entered and executed that code on an un-saved, newly generated file (Book1). It gave a FALSE response, indicating that it has found the operating Excel instance with the specified file. I pressed Ctrl+N to create Book2, ran the code for it, and once more received a FALSE.
When I ran the code again after saving Book2 but leaving it open, it returned a TRUE, indicating that the script had failed to identify it as an instance of Excel. I ran it with Book1 and it returned FALSE. I then ran the script with "Book1" and "Book1.xlsm," saved Book1 (of course as an.xlsm), and received a TRUE.
I closed everything, checked the Task Manager to be sure there were no active Excel instances, opened both files, ran the script, and TRUE.
The consequence is that a saved open file cannot be used by script to identify an Excel instance; only an unsaved open file can.