Skip to content

Tag: win32com

Converting Excel to PDF with pywin32 [Error]

I try to export one of my xlsx files as PDF with pywin32: Unfortunately I get this com_error: In the end I want to do use this conversion on 30 xlsx files at once. I know how to write the loop for this but can not fix the above mentioned error. Answer When using Python paths on Windows, you need

Timestamp of Outlook emails using Python

Is it possible to use Python to extract timestamps from received email? I’m using the following code but to no avail: I only get one date published repeatedly for each email. (i.e., 2021-11-22, 2021-11-22, 2021-11-22…….) Any help will be much appreciated. Answer Well, of course – you o…

Python: Open Excel file with win32

My code was working yesterday but today when I tried running it again it threw me an error and I’ve try to figure this out but I couldn’t. Hope you can help me out here. Thanks much! And this is the error the system threw: —> 11 wb = excel.Workbooks.Open(file) com_error: (-2147352567, &#8…

python-win32com excel com model started generating errors

Over the last few days, I have been working on automating the generation of some pivot tables for a number of reports. Boiled down to the minimum, the following code was working without issue: This would pop-up an instance of excel and I could continue working in Python. But suddenly, today my scripts are fai…

How can I use SetJob in win32print?

I want to clear or delete print jobs using Python. But how can I get JobID? win32print.SetJob(hPrinter, JobID , Level , JobInfo , Command) How could I run this code? Answer Starting from your code, I’ve managed to create a small script that deletes any print job on any (local) printer (I’ve tested…

Python win32com constants

I’m currently wondering how to list the constants in win32com in python, for example using excel win32com.client.Dispatch(‘Excel.Application’) Is there a way to display all constants using win32com.client.Constants ? Or does someone know where i could find win32com’s documentation ? Be…