11 lines
333 B
11 lines
333 B
5 years ago
|
import win32com.client as win32
|
||
|
def OpenWorkbook(xlapp, xlfile):
|
||
|
try:
|
||
|
xlwb = xlapp.Workbooks(xlfile)
|
||
|
except Exception as e:
|
||
|
try:
|
||
|
xlwb = xlapp.Workbooks.Open(xlfile)
|
||
|
except Exception as e:
|
||
|
print(e)
|
||
|
xlwb = None
|
||
|
return(xlwb)
|