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
0
votes
0 answers

Change the color of a category of an outlook email in python

I am working on a python project for outlook. The goal is to analyze the content of emails and then put a category on it. To do that, I use the win32com library and here is the following piece of code that I use: self.message.Categories = "My…
Loulouw
  • 21
  • 4
0
votes
1 answer

Why does Python's version of Excel's Range.Resize not work as expected?

In Excel VBA the code below selects the columns A to E. worksheet.Columns(1).Resize(ColumnSize:=5).Select But in Python (using the win32com.client module) the code below doesn't work. worksheet.Columns(1).Resize(ColumnSize=5).Select() # TypeError:…
user7393973
  • 2,270
  • 1
  • 20
  • 58
0
votes
0 answers

Call ActiveX COM methods without VC++/VS

I have a photosensitive device frontend from Thorlabs (KPA101) of which I am trying to get the signals values through a call of a method (ReadSumDiffSignals) of a COM/ActiveX object (APTQuad). Thorlabs give an example of how to do that using VC++…
Mister Mystère
  • 952
  • 2
  • 16
  • 39
0
votes
0 answers

win32com freezes for a couple of minutes onsave to PDF

I'm having some code that loops through word files and saves them to PDF. In general it works fine - no error is thrown but the thing is that a couple of first files are processed for 2-3mins each, then it goes smoothly. Do you have any ideas what…
jabba
  • 503
  • 2
  • 6
  • 14
0
votes
1 answer

Change ReceivedTime format on outlook using python

I am trying to write a code to extract the date and time of the last email received in my inbox to a text file. Current format of the output from my variable b is '2020-07-18 16:53:10.444000+00:00'. I want the format to be in this format '%m/%d/%y…
0
votes
1 answer

Python Export Report Microsoft Access using win32com.client

I have some reports in Access format and I want to generate PDF of these reports from Python script. I read a lot of questions and answers about how to do it and came up with this simple script. My code is: import win32com.client as win import…
RBenet
  • 171
  • 1
  • 10
0
votes
0 answers

Printing Excel files to PDF stops after first file USING Python, win32com

Hey Guys! hope you're having an awesome day, please help :) I need to print a specific sheet to PDF out of every Excel file in a dir of thousands. I keep getting the same error, the first file prints perfectly but when the script advance to the…
0
votes
0 answers

Trying to Send multiple emails by click of button using Tkinter with browsing file which has information of emails in python tkinter

I am trying to send multiple emails with click of button through tkinter, i have an excel file where i have written all my information (To-List,CC-List,Email-Subject,Email-Body) and saved in the folder. Now i want to open the file through Browse…
0
votes
1 answer

How to Group by Date Field in a PivotTable using win32com.client

I tried many approaches from last few hours but no luck. Somebody please help me. group_dt = pt.PivotFields('Created') group_dt.LabelRange.Group(Start=True, End=True, Periods=Array(False, False, False, False, True, False,…
0
votes
1 answer

Python win32com SaveAs2 error when I try to save file

def convert_to_word(): target = pwd + "/open.doc" source = pwd + "/template.html" pythoncom.CoInitialize() app = win32com.client.Dispatch("Word.Application") pythoncom.CoInitialize() # try: app.Documents.Open(source) …
punnpkin
  • 11
  • 3
0
votes
1 answer

Is it possible to use win32 in python 3.8 for pressing keys on your keyboard

I have created an app that presses some keys on the keyboard using pydirectinput. The problem is that pydirectinput is a bit slow and my app needs to be fast. Does anyone know how to make keypresses using win32 and if so, can you show me how to…
0
votes
0 answers

How to automate an existing publisher file (.pub) using win32com?

Is there any way I can automate my publisher file. I have a publisher template and I want to edit few parts of the file with new data every time. And data is in an excel file. Basically I want to edit excel file with the publisher template to get…
Mr Anonymous
  • 75
  • 10
0
votes
1 answer

Block Windows clipboard from user with Python while Program running

I want to make it impossible for a user to copy data to the clipboard as long as my program is running. How would I go about to do that in Python ?
PAP
  • 38
  • 4
0
votes
1 answer

How to read the top 3(the latest) threads present in an email using python

I was able to parse through the emails body that is present in a particular directory but it is trying to read all the threads the email has. The code I used to read the files from a directory is as follows. How to get only the top 3 threads present…
0
votes
1 answer

How to get a range of cells while retaining their format from an .xlsx document?

I am trying to print a range of cells from xlsx to pdf using below code from win32com import client xlApp = client.Dispatch("Excel.Application") books = xlApp.Workbooks.Open('C:\\Users\....\\2020.xlsx') ws = books.Worksheets['TEST'] ws.Visible =…