You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Take the scenario whereby I have two spreadsheets open, one on which I run my xlwings function (call it fileA)and the other on which I'm currently doing something else (call it fileB)
when I have something running on fileB be it a formula highlighted or a form window open, then I run my xlwings fct on file A, that usually generates an Attribute error :
AttributeError: .Application
As a potential fix, I realised that
changing the exception handling in get_xl_apps() in file _xlwindows.py
from :
defget_xl_apps():
xl_apps= []
hwnds=get_excel_hwnds()
forhwndinhwnds:
try:
xl_app=get_xl_app_from_hwnd(hwnd)
xl_apps.append(xl_app)
exceptWindowsError:
# This happens if the bare Excel Application is open without Workbook# i.e. there is no 'EXCEL7' child hwnd that would be necessary to make a connectionpassreturnxl_apps
to
defget_xl_apps():
xl_apps= []
hwnds=get_excel_hwnds()
forhwndinhwnds:
try:
xl_app=get_xl_app_from_hwnd(hwnd)
xl_apps.append(xl_app)
except (WindowsError,AttributeError):
# This happens if the bare Excel Application is open without Workbook# i.e. there is no 'EXCEL7' child hwnd that would be necessary to make a connectionpassreturnxl_apps
tends to solve the problem
The text was updated successfully, but these errors were encountered:
Hi guys,
Take the scenario whereby I have two spreadsheets open, one on which I run my xlwings function (call it fileA)and the other on which I'm currently doing something else (call it fileB)
when I have something running on fileB be it a formula highlighted or a form window open, then I run my xlwings fct on file A, that usually generates an Attribute error :
AttributeError: .Application
As a potential fix, I realised that
changing the exception handling in get_xl_apps() in file _xlwindows.py
from :
to
tends to solve the problem
The text was updated successfully, but these errors were encountered: