Questions tagged [win32com]

win32com is a Python module to interact with Windows COM components.

win32com is a Python module to interact with windows COM components.

The Python COM package can be used to interface to almost any COM program (such as the MS-Office suite), write servers that can be hosted by any COM client (such as Visual Basic or C++), and has even been used to provide the core ActiveX Scripting Support.

1472 questions
92
votes
9 answers

ImportError: No module named win32com.client

I am currently using python 2.7 and trying to open an Excel sheet. When using the code below: import os from win32com.client import Dispatch xlApp = win32com.client.Dispatch("Excel.Application") xlApp.Visible = True # Open the file we want in…
user3194189
  • 1,021
  • 1
  • 7
  • 8
59
votes
6 answers

Clearly documented reading of emails functionality with python win32com outlook

I'm trying to understand outlook interaction through win32com better. I've been unable to find clear documentation that allows me to utilise win32com to read emails effectively, from my current investigation it seems like a fairly regular sentiment…
Phoenix
  • 3,586
  • 9
  • 32
  • 49
50
votes
13 answers

.doc to pdf using python

I'am tasked with converting tons of .doc files to .pdf. And the only way my supervisor wants me to do this is through MSWord 2010. I know I should be able to automate this with python COM automation. Only problem is I dont know how and where to…
nik
  • 7,259
  • 11
  • 33
  • 40
22
votes
5 answers

Can't close Excel completely using win32com on Python

This is my code, and I found many answers for VBA, .NET framework and is pretty strange. When I execute this, Excel closes. from win32com.client import DispatchEx excel = DispatchEx('Excel.Application') wbs =…
sacabuche
  • 2,503
  • 1
  • 22
  • 35
19
votes
1 answer

Read Outlook Events via Python

Outlook has some things to desire - like showing multiple month view So I decided to give it a try by pulling out the event data via python (and then figure a way to display it nicely). Google is giving me pore results, but stackoverflow has been…
Norfeldt
  • 5,230
  • 13
  • 70
  • 118
18
votes
1 answer

Send email to multiple recipients using win32com module in Python

I am using win32com to send emails after my code is done. However, I cannot figure out how to send it to more than 1 person. Now I can only add myself in cc, but not in the recipient list. Here is my code: import win32com.client import datetime as…
lsheng
  • 2,609
  • 7
  • 28
  • 40
17
votes
4 answers

Interesting "getElementById() takes exactly 1 argument (2 given)", sometimes it occurs. Can someone explain it?

#-*- coding:utf-8 -*- import win32com.client, pythoncom import time ie = win32com.client.DispatchEx('InternetExplorer.Application.1') ie.Visible = 1 ie.Navigate('http://ieeexplore.ieee.org/xpl/periodicals.jsp') time.sleep( 5…
Tre Mi
  • 171
  • 1
  • 3
17
votes
2 answers

win32.Dispatch vs win32.gencache in Python. What are the pros and cons?

I have been recently using win32com.client from python as an API for windows applications but am struggling to understand some basic things. I had been using it with a program called WEAP, in the following way import…
Juan Ossa
  • 923
  • 1
  • 8
  • 12
16
votes
2 answers

Using win32com with multithreading

I am working on a web app with CherryPy that needs to access a few applications via COM. Right now I create a new instance of the application with each request, which means each request waits 3 seconds for the application to start and 0.01 for the…
stenci
  • 7,245
  • 11
  • 54
  • 89
14
votes
3 answers

List all methods in COMobject

Is it possible? Something in the lines of : import win32com.client ProgID = "someProgramID" com_object = win32com.client.Dispatch(ProgID) for methods in com_object: print methods I got the com_object.__dict__, which lists: [_oleobj_,…
f.rodrigues
  • 3,123
  • 6
  • 22
  • 55
13
votes
3 answers

Accessing unregistered COM objects from python via a registered TLB

I have three pieces of code that i'm working with at the moment: A closed source application (Main.exe) A closed source VB COM object implemented as a dll (comobj.dll) Code that I am developing in Python comobj.dll hosts a COM object (lets say,…
EB.
  • 2,893
  • 4
  • 27
  • 41
11
votes
2 answers

"Not implemented" Exception when using pywin32 to control Adobe Acrobat

I have written a script in python using pywin32 to save pdf files to text that up until recently was working fine. I use similar methods in Excel. The code is below: def __pdf2Txt(self, pdf, fileformat="com.adobe.acrobat.accesstext"): …
Blish
  • 113
  • 1
  • 5
11
votes
3 answers

python win32 COM closing excel workbook

I open several different workbooks (excel xlsx format) in COM, and mess with them. As the program progresses I wish to close one specific workbook but keep the rest open. How do I close ONE workbook? (instead of the entire excel application) xl =…
Razor Storm
  • 11,669
  • 19
  • 83
  • 143
11
votes
6 answers

Issue in using win32com to access Excel file

everyone! I have been using the win32com.client module in Python to access cells of an Excel file containing VBA Macros. A statement in the code xl = win32com.client.gencache.EnsureDispatch("Excel.Application") has been throwing an error: …
wordplayer
  • 123
  • 1
  • 2
  • 6
11
votes
3 answers

Error while working with excel using python

while my script is updating one excel same time if i am going to do any other work manually with another excel error occurs i am using dispatch from win32com.client import Dispatch excel = Dispatch('Excel.Application') excel.Visible …
sagar
  • 1,139
  • 4
  • 19
  • 38
1
2 3
98 99