i am trying to focus to excel file using win32com.client.
what i want is:
(1) simply return workbook instance when a given excel file is already opened.
(2) if that excel file is not opened yet >> open the excel file and then return workbook instance.
i am struggling because i don't know the difference between the methods getactiveobject & dispatch and so on...
in many cases, an error occurs >> (-2147352567 .......
can anyone make the code that i want?
this is a part of my code
'''
import win32com.client
xlsApp=win32com.client.GetActiveObject("Excel.Application")
myWB=xlsApp.Workbooks(workbook_name)
'''