我试图用pywin32打开powerpoint的现有文件,但是此代码无法激活窗口。 您对这个问题有什么想法吗?
import win32com.client
file_name = r'your file path\your file name.pptx'
Application = None
try:
Application = win32com.client.Dispatch("PowerPoint.Application")
Presentation = Application.Presentations.Open(file_name)
Application.Activate()
Application.Visible = True
*
*
some codes
*
*
except Exception as e:
print(e)
finally:
Application.Quit()
我尝试更改Application.Activate()和Application.Visible = True的位置,但是结果相同。