I have an excel sheet open and I'm trying to use _ExcelBookAttach. However, sometimes when I use the script it tries to open up the file again. Its giving the same action as if I double clicked the icon to open up the file and get that popup about it being locked for editing by the User. I have this excel file start with my computer since I need it for work. However, the weird thing is that when I shut it down and re-open it and try the script again it works. It attaches fine and I'm able to read cells.
Does anyone know what could be causing this type of action? Is there a way to insert code to see the error or action it performed and why?
Below is my test script I used where I still got the error. Thanks for any help.
#include <Misc.au3>
#include <Excel.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
Local $oExcel = _ExcelBookAttach(@DesktopDir & "\Morning IND.xls") ; Path to excel file that is on the desktop
Exit