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
1 answer

excuse me how to rename the slide master by pypptx or win32com

How to rename the slide master by pypptx or win32com? I found the following code can read the name, but it can not rename. Please tell me how I can do that? # coding: utf8 from pptx import Presentation from pptx.oxml import parse_xml from…
caedy
  • 3
  • 1
0
votes
1 answer

Selecting a folder from a VBA popup that was run from Python

I am using Python and the win32com.client library to run a VBA macro. The macro requires a directory (which is a substring of the .xlsm path itself). How do I pass this directory/string to the VBA popup? import os, os.path import win32com.client if…
0
votes
0 answers

Python win32com convert from xlsx/xls to xlsm?

I have seen many responses for win32com on how to convert from xlsm to xlsx or xls, but I am trying to do the exact opposite. I tried to mimic the code used to convert xlsm to xlsx but I get an error message. The code I'm using is: import…
j_d
  • 79
  • 6
0
votes
1 answer

Unable to read e-mails from Outlook for last 1 hour with Python

I am trying to read emails from my outlook for last 1 hour. I have used the below code. here i am not getting any error but it is not giving me any output. import win32com.client import datetime as dt import pandas as pd date_time =…
PANDA
  • 137
  • 2
  • 9
0
votes
1 answer

Unable to find an entry point named 'Reset' in DLL 'CIMWin32.dll'

[DllImport("CIMWin32.dll")] public static extern UInt32 Reset(); When I Am Calling This Method Then I Getting Exception Unable to find an entry point named 'Reset' in DLL 'CIMWin32.dll'
0
votes
0 answers

Create a pivot table as it in excel

This is the piece of code i tried so far,it is creating a pivot table but not as same we see manually created pivot table is there is any other way to create it. I want to create a pivot table as it is in excel but it is just showing the numbers is…
0
votes
1 answer

How to change color of text SetDlgItemText using SetTextColor in win32?

As I am working in Win32, I want to display a message using SetDlgItemText. The message should vary its color depending on success or failure (say for example green for success, red for failure). The code for the function: if { //if…
0
votes
2 answers

Python's win32com not closing?

I'm trying to close an Excel sheet that I have open using win32com, but the following code doesn't work: from win32com import DispatchEx xlApp = client.DispatchEx("Excel.Application") books = xlApp.Workbooks.Open(str(main_folder) +…
j_d
  • 79
  • 6
0
votes
1 answer

Save the current selection as HTML in Excel with Python

In Excel, when saving a workbook to an HTML file, one has the choice to save the entire workbook or the current selection only. How can one programmatically perform the latter using Python win32com library?
Roméo Després
  • 1,777
  • 2
  • 15
  • 30
0
votes
1 answer

Python - VBA Improvement

I have a pandas dataframe df. I then save it as an excel file Report.xlsm and then I add VBA code to filter this data. The code runs well. However, when I execute the VBA code, Excel always shows the message box to ask to save the Report.xlsm. Does…
0
votes
0 answers

Error FileNotFoundError: [WinError 2] while trying to delete file from directory

I'm trying to delete a specific file from a directory with the following code: def PPTtoPDF(inputFileName = 'presentation.pptx', outputFileName = 'presentation.pdf', formatType = 32): try: os.remove(os.path.abspath(outputFileName)) …
olenscki
  • 487
  • 7
  • 22
0
votes
1 answer

Process multiple Excel workbooks through one macro enabled workbook one at a time?

OK, so I've got one workbook that processes data from all export workbooks. I need to take every new export workbook and run it through the processing workbook one at a time in chronological order of when they are submitted then rename the finished…
Tyler Burr
  • 29
  • 1
  • 6
0
votes
1 answer

Element-wise manipulation of a two dimensional list in python

I am writing a script to find meeting time for three people. I manage to get their Free/Busy status encoding in a binary format with 0 being free and 1 being busy in increment of 30 minutes for the next three days. I grouped their status by day into…
BoBoMann
  • 101
  • 1
  • 7
0
votes
0 answers

How to check for empty document.paragraph values extracted from doc.table?

I am using the win32com Python module to target a Word .doc table and then extract all Sentences/ListParagraphs from it. I am able to successfully get the all my content using doc.Paragraphs. I then try to run.. EDITED: doc =…
The Mob
  • 391
  • 3
  • 10
0
votes
0 answers

Python Continuous Query Notification listener with Windows service

Am building a python script with continuous query notification and trying to build that as a windows service. Below is my code: import servicemanager import socket import sys import win32event import win32service import win32serviceutil import…