Questions tagged [com-automation]

The use of COM IDISPATCH interface to enable dynamic invocation of component functions or access to properties, using names instead of addresses in virtual tables.

Many COM components allow other programs to access their functions, not only by a defined specific interface, but also through the IDIspatch interface, which provide invoke service to access a property or call a function, using its DISPID (an internal dispatch identification) and also a service to get DISPIDs from names.

70 questions
4
votes
4 answers

Using PasteExcelTable to copy Excel data to the body of an Outlook email with Python

Formatted Excel range copied to a Word file This copies a range of cells from Excel and pastes them into a Word document with formatting preserved. The code works for this. However, I also want to paste the data into the body of an email with the…
2
votes
2 answers

Download outlook attachments with vba according to subject does not work on other computers

The code reads the lines from Excel in column "A", looks for them in Outlook and downloads the attached file to the folder that is in range("E3"), which changes depending on the computer. But, on my computer it works perfectly, on my colleagues'…
2
votes
3 answers

Strange InterfaceSupportsErrorInfo error - checkErrorInfo -2147352567 Error: Exception occurred

I'm currently building a bit of code to search my emails for a particular subject and then search the body of the emails for some particular terms, then take comma separated data out of it. However I have now encountered an issue which I've never…
alec22
  • 735
  • 2
  • 12
2
votes
1 answer

Outlook$CreateItem(0) crashes R (using package RDCOMClient)

I solved this issue but documenting here in case anyone experiences difficulty using RDCOMClient to send Outlook emails via R. Using fresh install of Windows 10 Pro for Workstations running as a VirtualBox VM, R version 4.1.1, Rstudio 2021.09.0…
cmcgraw
  • 61
  • 4
2
votes
1 answer

Sending image as argument from C# to matlab function

I'm trying to call a MATLAB function from C# using MLApp class, feval function specifically. Since I'm a beginner I looked through the internet and found help calling MATLAB functions. I just simply called a MATLAB function which takes two integers…
Atif
  • 159
  • 3
  • 11
2
votes
0 answers

Why wouldn't ITypeInfo::GetIDsOfNames work?

I am reworking some code for COM automation. Working with an IDispatch client for Excel (application), I can evaluate idispatch.GetIDsOfNames('Run' 'Macro' 'Arg1' 'Arg2') and it works. It returns an array with the memberID of the method for Run…
Carlos E. Ferro
  • 930
  • 10
  • 21
1
vote
2 answers

ComObject alternative for the New Outlook Preview app

Our organisation is migrating to Office 365, this means mail will be available via Exchange Online so user can access there mail via the webbrowser but also via the "New Outlook Preview" app in Windows 10/11. A suggestion that has been made is to…
1
vote
1 answer

Outlook COM object - Marking an Email as Read

Using w32 python library, I am taking an email and saving the attachment from Outlook. I have seen several questions dealing with this topic with the most promising being here: Marking an email as read python I have tried a few variations of the…
John Smith
  • 2,448
  • 7
  • 54
  • 78
1
vote
3 answers

How to start Outlook with Python and win32com

I manage to open Outlook Elements like mails or task with this code: import win32com.client as win32 outlook = win32.gencache.EnsureDispatch('Outlook.Application') new_mail = outlook.CreateItem(4) new_mail.Display(True) And its possible to open…
1
vote
2 answers

Powershell script for replying to email

I am trying to reply to emails using PowerShell, and the code below works successfully, but it doesn't show the original message I'm responding to: Add-Type -assembly "Microsoft.Office.Interop.Outlook" Add-type -assembly…
1
vote
1 answer

If statement is not working in below python code it skip if statement and run else statement only

I have prepared code for mail automation. It will read the contents of of a CSV file and compare it with mail body and fetch the information and share it via mail. The if-statement will not work code run: it only executes the else statement. The…
1
vote
0 answers

PowerShell Excel Interop - InvalidCastException, environmental causes?

I have a large PowerShell script that automates the creation of an Excel workbook from scratch. For months now, I have been unable to resolve one issue - but only when run from certain environments (more on this below). To simplify this to a…
ziesemer
  • 27,712
  • 8
  • 86
  • 94
1
vote
2 answers

Macro used to run on Outlook 2013, now doesn't run on Outlook 2021 on a new computer

A few years ago I had a developer write a macro for me to print the current email as two pages per page rather than on two separate pages. It used to run successfully on my old computer Win 10/Outlook 2013. I now have a new computer Win10/Outlook…
Ramjet
  • 11
  • 1
1
vote
1 answer

Download outlook attachment

I have the below code that downloads he attachments from the outlook. But I'm having two problems. 1. Attachment wont be downloaded if there is already a file with the same name in the folder. I want it to be replaced with the new file (file names…
1
vote
2 answers

win32com Outlook client has no attribute 'GetNameSpace'

I was working well with GetNameSpace('MAPI'), but I wrote an ActiveState code: import Outlook contacts using win32com and GetNameSpace is not longer useful. Now the code has changed: Is useful GetNamespace('MAPI'). Why did this happen and how to…
1
2 3 4 5