So Far, my code is:
from pywinauto import *
app = Application().start(r"C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\EXCEL.exe")
dlg = app.Excel
app = Application().connect(path=r"C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\EXCEL.exe")
dlg = app.Excel
But I can't Open a file!!
Any help would be apreciated!!
PS I am using the gui so I can use an excel extension
I open a file this way (don't forget to put "r" before both strings if you use single "\\")
from pywinauto import Application
program_path = r"C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.exe"
file_path = r"C:\file.xlsx"
app = Application().start(r'{} "{}"'.format(program_path, file_path))
If you just want to open an Excel program using Pywinauto, you can use this snippet codes as followed:
from pywinauto import Application
app = Application(backend="uia")
app.start(r"C:/Program Files/Microsoft Office/root/Office16/EXCEL.exe")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.