Reputation: 7
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!!
P.S I am using the gui so I can use an excel extension
Upvotes: 1
Views: 4849
Reputation: 423
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")
Upvotes: 2
Reputation: 151
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))
Upvotes: 2