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.

Office Interop is the layer using the COM Interop that allows .NET or C# to communicate with standard COM objects and libraries.

3602 questions
7
votes
4 answers

error "string parameter too long". at microsoft.office.interop.word.find.execute

I want to create a world document using C#. So this is my code for replace word document variables. private void FindAndReplace(Microsoft.Office.Interop.Word.Application WordApp, object findText, object replaceWithText) { try { …
aruni
  • 2,664
  • 10
  • 44
  • 68
7
votes
4 answers

C# Outlook 2007 COM interop application does not exit!

Any ideas why the following code does not exit the Outlook 2007 process created via COM interop? Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); var item =…
Nikolaos
  • 1,449
  • 2
  • 15
  • 19
7
votes
1 answer

C# Get list of opened Word documents

Currently, I'm using this code to get the list of MS Word opened documents: List doc_list = new List(); try { Microsoft.Office.Interop.Word.Application WordObj; WordObj =…
yuko
  • 151
  • 2
  • 12
7
votes
2 answers

How do I make an Office 2013/2016 application run in separate process on Microsoft Windows?

I am developing a Excel plugin. It works all right for Excel versions before 2013. But a lot of features is broken when it runs against Excel 2013. I found the root cause is all windows are running in only one process in Excel 2013. Even if user…
Ling
  • 71
  • 1
  • 1
  • 2
7
votes
1 answer

VSTO (Document-level): Individual context menu in Excel (right click menu)

Is it possible to disable or configure the (cell, range) context menu via C# (VSTO). If yes, how can I implement it (in a document-level VSTO Excel application) For example I want to disable some items in the context menu (e.g. copy/paste) and add…
M. X
  • 1,307
  • 4
  • 19
  • 34
7
votes
3 answers

Prevent Word document's fields from updating when opened

I wrote a utility for another team that recursively goes through folders and converts the Word docs found to PDF by using Word Interop with C#. The problem we're having is that the documents were created with date fields that update to today's date…
Doug Dawson
  • 1,254
  • 2
  • 21
  • 37
7
votes
1 answer

Does the inability of IMessageFilter to handle 0x800AC472 (VBA_E_IGNORE) make implementing IMessageFilter irrelevant?

From msdn it seems that IMessageFilter doesn't handle all exceptions, for example, at some points, office applications 'suspend' their object model, at which point it cannot be invoked and throws: 0x800AC472 (VBA_E_IGNORE) In order to get around…
Pat Mustard
  • 1,852
  • 9
  • 31
  • 58
7
votes
2 answers

Word Interop Copy Formatted Text of Table Cell

I am writing an addin for word to automate editing of a protocol template. In the template is a table and I want to extract/copy the formated text of a cell inside this table. Right now I am doing it this way: Range formattedText =…
Tobias
  • 2,945
  • 5
  • 41
  • 59
7
votes
3 answers

find all open Excel workbooks

I'm trying to get a list of all currently open Excel workbooks, so that the user can select which one of them to get some data from. I tried this: List excelList = new List(); Process[] processList =…
sigil
  • 9,370
  • 40
  • 119
  • 199
7
votes
1 answer

How to set the file name of a Word document without saving it from c# and automation II

I have asked here a question on how setting the filename of a Word document via automation without saving it. Thanks to Remou, I have received a nice way doing this via calling the FileSummaryInfo-Dialog and setting the Title-property. However now I…
HCL
  • 36,053
  • 27
  • 163
  • 213
7
votes
2 answers

How do I programmatically drop a Milestone onto a Block Timeline in Visio

I'm trying to programmatically create a timeline and markers using the Visio 2010 COM Interops. My code is based off of Chris Castillo's 2 part blog posting (Part 1, Part 2), which is the only semi-complete example I've been able to find on how to…
Tom Halladay
  • 5,651
  • 6
  • 46
  • 65
7
votes
2 answers

How do I avoid RPC_E_CALL_REJECTED exceptions when performing PowerPoint automation?

When my code tries to create a new instance of Microsoft.Office.Interop.PowerPoint.Application, I sometimes get the following exception: System.Runtime.InteropServices.COMException (0x80010001): Retrieving the COM class factory for component with…
Chry Cheng
  • 3,378
  • 5
  • 47
  • 79
7
votes
3 answers

Save as PDF using c# and Interop not saving embedded pdf in a word document

Background: I am trying to generate a word document using c# and Interop. I am successful in inserting tables, headers, footers, diagrams..most of the things are working fine. As a next step, I am looking to convert this into pdf. Process adapted:…
Naga Sandeep
  • 1,421
  • 2
  • 13
  • 26
7
votes
3 answers

Is there a way to tell PowerPoint not to open Excel when creating charts?

Slide.Shapes.AddChart() automatically opens Excel. Even if I quickly do Chart.ChartData.Workbook.Application.Visible = false, it still shows a little while. This makes automating chart creation error-prone as the user has to try not to touch the…
simendsjo
  • 4,739
  • 2
  • 25
  • 53
7
votes
4 answers

c# ms word get visible text

I'm trying to obtain the text shown in a MS Word window in C# using Microsoft.Office.Interop.Word. Please note it's not the whole document or even the page; just the same content the user sees. The following code seems to work with simple…
Nacho
  • 962
  • 6
  • 14