Questions tagged [office-interop]
Office Interop is the layer using the COM Interop that allows .NET or C# to communicate with standard COM objects and libraries.
3,449
questions
0
votes
1
answer
9
views
VSTO Outlook: Understanding what is Inline response and what's the difference between ActiveInlineResponse and ActiveInlineResponseWordEditor
I am very new to VSTO Outlook Add-in and sometimes I get lost with terminology.
I have some code for an Outlook Add-in which was made by a colleague and now I am maintaining it.
In code I see things ...
0
votes
1
answer
22
views
Word Interop- Are there any unique identifiers in document object's paragraph/ranges?
My problem is this: I open a word document (using WordprocessingDocument) and take specific paragraphs from it. Then, I need to find these paragraphs (by text) in a Word activeDocument using .NET VSTO....
0
votes
2
answers
52
views
Get WordEditor property in Word Document
I need to obtain the WordEditor property to Word object in order to work with the word document.
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Reflection;
using WORD = Microsoft....
0
votes
1
answer
51
views
copy excel range to outlook mail body in C#
Static void Main(string[] args)
{
EXCEL.Application aap = new EXCEL.Application();
string filelocation = "C:\\AdventureWorks_Sales.xlsx";
Workbook wrkbok = aap.Workbooks.Open(...
2
votes
0
answers
47
views
Watermark location is different in word and PDF document in MS interop C#
In my program, there is a function with which users can add watermark to docx or PDF files.
Application wordApp = new Application();
wordApp.Visible = false;
wordApp.ScreenUpdating = false;
Microsoft....
0
votes
1
answer
52
views
C# Interop Excel find column by name then store entire column by row
I'm trying to create a program that will read through a new spreadsheet every time. This program has to find a column named "ID" and store all the IDs below and store the corresponding ...
0
votes
2
answers
38
views
VSTO Outlook: Items.ItemAdd on Inbox, sent and draft folders -> Detect if it is fired as a result of a movement action caused by user
I am trying to detect when an item is moved from one folder to another because in this use case I need to perform some actions. I need to detect when event is fired by a movement action caused by the ...
0
votes
1
answer
30
views
C# Excel VSTO save a Filter in Sheet View
It´s possible to save a filter in Excel using COM API? This feature is very useful if you have someone else working with the same excel to have a different filter for each user.
I know there is a new ...
0
votes
1
answer
11
views
VSTO Outlook ItemAdd not being fired when moving an item to the target folder
I am trying to do some things on ItemAdd event when an item has been moved to a target folder but ItemAdd event is not firing.
I have declared the source object (the global list MyOlItemsLst) at the ...
0
votes
1
answer
38
views
VSTO Outlook: Detect when a message is moved from a folder to another
Is there any way to know when a message is moved from a folder to another in the explorer view? Some event I can handle?
I need to do some things just when a message is moved from one folder to ...
-2
votes
1
answer
31
views
"Unable to set the FreezePanes property of the Window class" : Microsoft.Office.Interop.Excel.Window.set_FreezePanes not working in Windows 10 [closed]
While open my application in Windows 10 then Microsoft.Office.Interop.Excel.Window.set Properties not working. Same data setting in Windows 7 working fine.
at System.RuntimeType....
0
votes
2
answers
28
views
Outlook flickering on adding too much recipients to "To" field when composing a new e-mail
I have an VSTO Outlook Add-in. In compose windows, every time a recipient is added to the "To" field, I iterate over all the recipients to search for some recipients not satisfying a ...
0
votes
2
answers
34
views
Iterating on Outlook COM objects
I have a doubt about when iterating over Outlook COM objects and whether I need always to release them or not.
What is the difference between below two for loops?
(suppose recipients is of type ...
0
votes
1
answer
37
views
Outlook VSTO Add-in: Removing a lot of recipients is too slow and not always work
I have an VSTO Outlook Add-in. In the compose windows I have a button. When this button is clicked the recipients that satisfy a condition are removed. The recipients that need to be deleted are ...
0
votes
2
answers
34
views
Does MS Office JavaScript API for Word include all the functionality of VSTO/VBA?
I have a very big and complex project in VBA that parses and changes the content of word documents in a variety of ways. I need to decide whether to rewrite it in .NET VSTO or using the newer ...
-1
votes
1
answer
18
views
Paste Outlook Table into Excel Worksheet using Interop in c# from background Thread
How do I 'copy / paste' an instance of an Microsoft.Office.Interop.Word.Table which has styling (Colors, Borders etc...) into an Excel Worksheet using the Microsoft PIA from a background thread in C#?
...
0
votes
1
answer
24
views
custClrList of PowerPoint presentation
I'm using Microsoft.Office.Interop.PowerPoint library to work with PowerPoint presentations and looking for a way to programmatically modify 'Custom Colors' section of color palette. I can see that it'...
1
vote
1
answer
78
views
C# class instance displays property values but does not allow direct referral
Why would outlook.Version display error CS1061: 'Application' does not contain a definition for 'Version' when the value is clearly 16.0.0.14326?
Building on this question:
Outlook Interop - '...
0
votes
2
answers
68
views
Outlook Interop - 'Class' does not contain a definition for 'Property'
Ultimate Goal/Frame Challenge:
I'm trying to append the user's name and e-mail address to a template e-mail before sending it.
Approach
I'd like to use the DisplayName and SmtpAddress properties of ...
0
votes
1
answer
19
views
Set appropriate initial height for custom task pane in VSTO Outlook Add-in
I have an VSTO Outlook Add-in in which I create a custom task pane and I assign a usercontrol to it.
How can I set the initial height of the custom task pane in order to be device-independent, I mean,
...
0
votes
3
answers
30
views
C# program that uses RDO only hangs when exiting if Outlook is not running
We have an internally written program in C# that use RDO in Outlook Redemption to create, modify, or delete contacts in an Outlook Contacts folder. This is Outlook 2019 connected to on-premise ...
0
votes
1
answer
18
views
COMException when trying to create Excel.Workbook
short disclaimer in order for you to understand how to phrase your answers: I am a total newbie when it comes to programming. All I know are the basic concepts of object oriented programming and VBA, ...
0
votes
1
answer
37
views
No Core (from Microsoft.Office.Core) in Microsoft.Office.Interop.Excel NuGet package
In the context of the question
In Excel-DNA adding a new line in context menu at right-click on a cell in a spreadsheet
I need to use the _Application.CommandBars property from the Microsoft.Office....
0
votes
0
answers
35
views
VSTO Outlook: Assigning height from WPF UserControl.Size.Height to ctp.Height
I have an WPF UserControl that I have created and assigned to a Microsoft.Office.Tools.CustomTaskPane.
MyUC uc = new MyUC();
Microsoft.Office.Tools.CustomTaskPane ctp = Globals.ThisAddIn....
-1
votes
0
answers
41
views
Generate an email via C# in Visual Studio Code
I am trying to generate an email in Visual Studio Code. I want to be able to open Outlook with the email already populated so the user can edit the email, if they wish, and send it manually. Is this ...
1
vote
0
answers
38
views
Does this VBA code side-effect on Visio's recalculation queue also happen in .NET VSTO solutions?
To optimize the performance of Visio code that changes a Visio diagram and formulas in cells of Visio shapes, Visio has the Application.DeferRecalc property to prevent continuous recalculation of the ...
0
votes
0
answers
38
views
C# Word Interop: find.Execute() Throws exception if the found text is in a table
I am developing a word automating application using .NET windows form application, The problem occurs when I call range.Find.Execute() on a text that is inside of a table cell.
Whenever I call it, a ...
0
votes
1
answer
86
views
How do I get specific text from excel worksheet using C#?
I'm wanting to find multiple cells where a string is present. So usually a cell will have a int and the next cell will have a string. Is there anyway to find the string and print the value(int) to the ...
0
votes
3
answers
41
views
VSTO Async/Await - unable to cancel a long running operation
I'm developing a search tool for Word in C# with VSTO and WPF (MVVM).
I'm using the Microsoft.Office.Interop.Word.Find() method and iterating through the document to find matches. Some of the document ...
0
votes
1
answer
32
views
Creating multiple tables dynamically on Word using C#
First of all let me start by saying I'm coming over from Javascript to C# and have never used the Word Interop before so forgive me if I make any stupid mistakes.
I'm trying to create a series of ...
0
votes
0
answers
25
views
C# Outlook message/folder creation and delay
I have simple application which saves programmatically folders and emails in local Outlook application. Code works fine but I observed that I have to add sleep when folder or message has been created ...
0
votes
1
answer
58
views
Uncheck "allow only this type of editing in the document" option
How to not display gray color and brackets after disabling word document protection with Microsoft.Office.Interop.Word library in C#.
Image
How to uncheck "Allow only this type of editing in the ...
0
votes
0
answers
96
views
Using C# Microsoft.Office.Interop.Excel but Getting error Could not load file Version=15.0.0.0
Trying to import the data from an Excel sheet into a Sql Server table. The code is activated by a button in a userform. But I am getting the error below when clicking it. I am using a work machine and ...
0
votes
0
answers
20
views
Error when working with Excel's worksheet by C# [duplicate]
When I working with Excel by C#. If I worked in the same worksheet, it's ok. But when I worked in difference worksheets. It has an error : System.NullReferenceException: 'Object reference not set to ...
0
votes
0
answers
37
views
How to auto-hide the ribbon in Word?
I would like to auto-hide the ribbon in Word with Interop. Is there any way to achieve this? At the moment I only know ToggleRibbon(), which sets the Ribbon Display Options to "Show Tabs".
...
0
votes
2
answers
60
views
How to get the results of language identification by Outlook
When the translation function is enabled in Outlook, I was wondering if anyone knows how to get the results of language identification of the email body.
As shown in the figure below, Outlook has a &...
0
votes
2
answers
41
views
How to apply Gradient to Line/Border of a shape in Powerpoint using C#?
In PowerPoint 2016 UI, it is possible to apply a gradient to the Border of a shape. The same however cannot be done using Microsoft.Office.Interop.PowerPoint in C#. I was able to apply a gradient to ...
0
votes
0
answers
22
views
Power point VSTO Addin How to Distingush Save and SaveAs on PresentationBeforeSave
I have a word, excel and ppt vsto addin written with C#. My boss says that if users click save button, sometimes i need to show an alert that this is forbidden (after some business rules). However, ...
0
votes
0
answers
34
views
Retrieving the COM error in Visual Studio
i want to ask about coding VB.NET to export the data from datagridview into excel file..
last month it work completely fine..after left for a month it went so many error.. i never change a coding or ...
0
votes
1
answer
40
views
Outlook Interop add body text
Updated to try and make the question more readable, following comments below
Scenario:
user clicks reply in outlook 365 this opens a mailItem within the main window of outlook. we are attempting to ...
1
vote
1
answer
26
views
Bypass Outlook hyperlink warning by specific application
There is a warning when you send emails via Outlook by using the Microsoft.Office.Interop.Outlook objects. There are several workarounds in form of disabling the complete security warning. That is not ...
0
votes
1
answer
31
views
Microsoft office interop word parse equation object and oMath objects as images instead of html
I have a docx file that I try to parse into HTML which works pretty good using microsoft office interop library.
when there are some math equations in the docx file it parse them as images.
My problem ...
0
votes
1
answer
31
views
Accessing AnswerWizard of Outlook from C# WinFormsApp
Is there any possibility to access the automatic answering function of Outlook out of my humble WinFormsApp (C#)? To activate it directly out of my App for the time of vacations e.g.
Really appreciate ...
0
votes
1
answer
33
views
Convert PDF to DOCX with Word interop
Is this possible to convert PDF file into DOCX with MS Word Interop library?
I see that that was possible via the UI - I was wondering if it could be done programmatically as well
0
votes
1
answer
21
views
ClickOnce winform does not open from start menu, after windows udates, starts working again after one/multiple computer restarts
Since some time the vb.net application I developed stops working for some users, usually after windows 10 updates. It starts working again after restarting computer one or more times, sometimes it ...
0
votes
1
answer
40
views
How To Only Retrieve Top X Items from Outlook Folder - Interop C#
I am writing a C# application where I want to loop through the 500 most recent emails in a given folder. The reason is because getting all the emails takes a long time using the below lines:
...
1
vote
1
answer
114
views
.NET Framework 4.8 Error referencing Microsoft.Office.Core
Im trying to build an old project on a new version of the .NET Framework. When I'm trying to build that Project an Error occurs.
"The file or assembly "Interop.Microsoft.Office.Core" or ...
0
votes
1
answer
102
views
.NET VS ERROR "Interop.Microsoft.Office.Core" wasnt found
I'm trying to run an old Project which was written years ago on a new System.
It's an .NET Project and it has references to Microsoft.Office.Interop.Excel, ...Outlook, ...Word, etc.
When i run the ...
0
votes
1
answer
30
views
Convert DOC with macro to DOTM
I am trying to convert DOC files with macros to DOTM with macros. My code changes the files but after the marco section is totally broken. When I convert it manually my macro code stays.
My code is:
...
-2
votes
1
answer
46
views
Creating complex Office 365 documents in VS Code
I have a web application that creates complex Office documents in Excel, Word, and PowerPoint; and I need to convert the application from Visual Studio to Visual Studio Code. The previous application ...