Python starts the office software processes of word excel PPT et WPS WPP of WPS

  • 2020-04-02 09:23:09
  • OfStack


#-*- coding:utf-8 -*- 
from win32com.client import Dispatch 
import time 
def start_office_application(app_name): 
#  Get it here app After other operations and passes VBA Operating office software is similar  
app = Dispatch(app_name) 
app.Visible = True 
time.sleep(0.5) 
app.Quit() 
if __name__ == '__main__': 
''''' 
 through python Start the application process of office software,  
 Among them wpp , et , wpp The correspondence is the kingsoft file, the form and the demonstration  
word , excel , powerpoint This corresponds to Microsoft text, tables, and presentations  
''' 
lst_app_name = [ 
"wps.Application", 
'et.Application', 
'wpp.Application', 
'word.Application', 
'excel.Application', 
'powerpoint.Application' 
] 
for app_name in lst_app_name: 
print "app_name:%s" % app_name 
start_office_application(app_name) 


Related articles: