win32com.client.Dispatch(“Outlook.Application”) error pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

后端 未结 2 1515
陌清茗
陌清茗 2021-02-09 01:45

I am on windows 7 and I have windows live installed. Now when I am trying to run following code

import win32com.client
win32com.client.Dispatch(\"Outlook.Applica         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-09 02:04

    I was having a similar error. Have you tried running makepy.py from win32com's folder to create entries for the different COMobject's you are using? Basically, win32com just treats all of applications you interact with as default COMobjects until you let it learn about the programs installed on your computer. You'll have to run makepy.py for each program you want to control with it.

    After I ran it, I gained access to much more control for Outlook. It has opened other errors that I am working on correcting.

    Also, if you take your comobject (comboject = win32com.client.Dispatch("Outlook.Application")) and look at comboject._prop_map_get_.keys() you'll see all the things you can use for that program.

提交回复
热议问题