Questions tagged [win32com]

win32com is a Python module to interact with Windows COM components. It is part of the Python for Win32 (pywin32) project by mhammond.

win32com is a Python module to interact with windows COM components. It is part of the Python for Win32 (pywin32) extensions project by mhammond, which provides access to many of the Windows APIs from Python.

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.

1868 questions
5
votes
1 answer

how to add drop down list in excel cell using win32com python

I am trying to add drop down in excel cell using python win32com api. But not able to implement it. Here is my code from win32com.client import Dispatch import os import win32api path = os.getcwd() path1 = path + '\\myExcel.xlsx' try: xl =…
Saurabh Agrawal
  • 7,581
  • 2
  • 27
  • 51
5
votes
1 answer

What defines which Excel instance an Excel.Application COM object connects to?

import win32com.client as win32 excel = win32.gencache.EnsureDispatch('Excel.Application') for wb in excel.Workbooks: print(wb.Name) When I run this script using Sublime Text: A list of the names of open workbooks is printed. When I run this…
ambiguous58
  • 1,241
  • 1
  • 9
  • 18
5
votes
1 answer

How to use win32com to handle overflow when querying Desktop Search?

I'm querying the Windows Desktop Search JET (ESE) database using Python + ADO. It works but after ~7600 records I get an exception when advancing to the next record using MoveNext. I know it is not at EOF because I can run the same query in VBScript…
Arthur Dent
  • 1,828
  • 13
  • 21
5
votes
1 answer

create a pivotchart with python win32com causes pywintypes.com_error

is there anyone can give a example code for creating a pivotchart in excel? I have got an example to create a pivottable with pivottable, it works , while when I try to create a pivotchart in the same ways, it will always failed! import…
xuanyao
  • 51
  • 1
  • 3
5
votes
4 answers

Python x64 bit on Windows x64 copy file performance evaluation / problem

when programming a kind of backup application, I did an evaluation of file copying performance on Windows. I have several questions and I wonder about your opinions. Thank you! Lucas. Questions: Why is the performance so much slower when copying…
lucas0x7B
  • 336
  • 1
  • 3
  • 12
5
votes
1 answer

How to get code-completion for COM programming in PyCharm?

When using app = win32com.client.Dispatch('Some.Application'), is there any feasible way get code-completion in PyCharm? It is rather tedious having to retype (or copy-paste) everything from an API documentation, so would creating skeletons be. Is…
Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
5
votes
4 answers

Create new Access database and tables using Python

I'm trying to create an Access database in Python and add two new tables to it. I'm using win32com and have managed to create the database but can't create the tables. All I get is unhelpful Windows errors. Can anyone help me? The following code…
WRJ
  • 617
  • 3
  • 9
  • 19
5
votes
2 answers

Python win32com get outlook event (appointment/meeting) response status

I'm trying to get events from outlook(2013) by using the Python win32com library, I have managed to do this, however I have not been able to get their status (Accepted, tentative, declined). It's important that I find out their status as the my…
Dan Gal
  • 99
  • 3
  • 10
5
votes
1 answer

What is difference between win32com and pywin32?

I know microsoft word document object mode and want to use python as development language what is difference between win32com and pywin32. I tried but could not find answer. Please guide me what to use for python 3.X.
Rahul
  • 10,830
  • 4
  • 53
  • 88
5
votes
4 answers

iTunes API for python scripting

I'm trying to develop some scripts for iTunes in python and actually i'm having quite a hard time getting the API information. I'm using the win32com.client module but i would really need to get all the specifications, methods and details. There…
pablora
  • 506
  • 1
  • 7
  • 18
5
votes
3 answers

copy entire excel worksheet to a new worksheet using Python win32com

I try to open an existing workbook called 'N11 Result.xlsx'. Copy the entire worksheet 'Sheet1' (rename it to'Built with Python' first...) and paste to a new worksheet(named 'Annual') within the same workbook. I think the last line of my code…
BenSeedGangMu
  • 211
  • 1
  • 3
  • 10
5
votes
1 answer

COM "get property" with multiple arguments

I'm trying to call WindowsInstaller.Installer.ProductsEx from python, and can't figure out how to make it work. Here's a vbscript version of what I want to call from python: dim msi, products set msi = CreateObject("WindowsInstaller.Installer") set…
Ryan Davis
  • 701
  • 8
  • 12
5
votes
1 answer

python win32com close Excel process

Trying to alter Excel_sheet by python and totally confused in process recovery. import win32com.client class XlsClass: def __init__(self ,filename=None ,*,Visible=False ,Alerts=False): self.xlApp =…
Tpoy
  • 53
  • 1
  • 1
  • 7
5
votes
1 answer

Python script involving Outlook through win32com runs when double-clicking, but not through task scheduler

I have a python script that sends out an email using win32com and Outlook. The script runs without a hitch when I run it through an interpreter or double-click on the script. However, when I run it through the Task Scheduler, I get the following…
chungsangh
  • 353
  • 1
  • 4
  • 15
5
votes
1 answer

win32com MemoryError: CreatingSafeArray attempting to insert data into excel

I'm attempting to insert a list of lists into excel (such that each inner list represents a row, each is of the same length) with the following call : #Assume ws is correctly initialized to an excel worksheet…
TheoretiCAL
  • 19,461
  • 8
  • 43
  • 65