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
13
votes
7 answers

How to save workbook without showing save dialog with Excel interop?

I have to create a Console application that exports a DataSet to Excel. The problem is that it shouldn't pop up the save window, it should automatically create the Excel file. So far I have the following code, but I don't know how to make it save…
ha1ogen
  • 13,375
  • 3
  • 19
  • 19
13
votes
0 answers

Why can't third party controls be added to custom ribbon in Office PowerPoint via customUI.xml

We are trying to put third-party add-in controls onto a custom ribbon via our add-in. 1) Customization via modifying the PowerPoint.officeUI is working:
Cilvic
  • 3,417
  • 2
  • 33
  • 57
13
votes
2 answers

Interfaces can't be instantiated but is this an exception

I'm very surprised after seeing that I actually have to Instantiate an Interface to use the Word Interoop in C#. Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); The…
JAX
  • 1,540
  • 3
  • 15
  • 32
13
votes
3 answers

Creating and managing custom task panes for multiple documents in a VSTO Word addin

I'm developing a Word 2007-2010 addin using VSTO in Visual Studio 2008. In my addin, I need a custom task pane for each open word document. Basically, I need to create a task pane for each document, show the correct task pane in the document window,…
sdds
  • 2,021
  • 2
  • 25
  • 33
13
votes
1 answer

Trying to do Office Automation with Excel 2007, but keeps using Excel 2003

Environment: Windows XP machine Both Excel 2007 and Excel 2003 installed (in that order, not chronologically). C# 3.5 Problem: When I use the PIAs to do some Office automation, I use the following line of code: var excel = new…
Andy_Vulhop
  • 4,699
  • 3
  • 25
  • 34
13
votes
5 answers

how to resolve The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

PowerPoint.Application PowerPoint_App; PowerPoint_App = new PowerPoint.ApplicationClass(); PowerPoint_App.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone; PowerPoint.Presentation presentation; presentation = null; try { …
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
13
votes
8 answers

"You are not allowed to edit this selection because it is protected." but only since Office 2013?

We've had these few lines of code running happily in our applications for several years (and in several versions of Office, 2003, 2007, 2010 etc). Purpose is to perform a kind of a mail merge in a Word document, substituting the field placeholders…
hawbsl
  • 15,313
  • 25
  • 73
  • 114
13
votes
3 answers

get_SynonymInfo throws insufficient memory exception for some words

I have a simple test program using Microsoft Word Interop to get word meanings from the Thesaurus dictionary: using System; using Word = Microsoft.Office.Interop.Word; class Program { static void Main(string[] args) { string word =…
Goran Rakic
  • 1,789
  • 15
  • 26
12
votes
2 answers

Setting an Outlook mailitem's category programmatically?

There doesn't seem to much information or any good code samples for setting an Outlook 2007 MailItem's categories programmatically. MSDN has a limited page, and mentions using VB's Split function, saying more or less "you're on your own from here…
hawbsl
  • 15,313
  • 25
  • 73
  • 114
12
votes
2 answers

How to connect to outlook while its running in c#?

What I am trying to do is add an "Email To..." button to a winform client that opens a new outlook mail window and attaches a file so the user can forward it. I can get the outlook integration working just fine if outlook is not already running.…
Jason
  • 2,701
  • 2
  • 25
  • 35
12
votes
4 answers

Access PowerPoint chart in C#

I have a problem in a C# project. In fact, I created a PowerPoint add-in and I want to generate charts on slides. I created a slide with: using PowerPoint = Microsoft.Office.Interop.PowerPoint; using…
user361369
  • 121
  • 1
  • 3
12
votes
1 answer

Excel 2013 crashing

I'm trying to embed Excel 2013 in a WPF app. The problem is that when I call SetWindowLongPtr in the following code, Excel 2013 crashes immediately. I digged it and found that if I comment out WS.CHILD style, it works fine, but the Excel sheet…
dotNET
  • 33,414
  • 24
  • 162
  • 251
12
votes
2 answers

Filling fields in Word using c# and Microsoft Word Interop

I tried to Fill out Form Fields in Microsoft Word using C# Interop Assemblies with the following Code string filename = @"N:\mehler\Vorlage2.dotx"; Microsoft.Office.Interop.Word.Application word = new…
sebastianmehler
  • 1,033
  • 1
  • 11
  • 23
12
votes
3 answers

Replace Field in Header&Footer in Word Using Interop

How to replace a "FIELD" in the header/footer? Ex: Word doc file with File Name & Date. in place of file path - [FilePath] instead C://Documents/Location/Filename.doc ,[Date] instead 18/07/2013. I can replace any text with range. foreach…
Jay
  • 1,869
  • 3
  • 25
  • 44
12
votes
3 answers

Calling this[int index] via reflection

I try to implement a reflection-based late-bound library to Microsoft Office. The properties and methods of the Offce COM objects are called the following way: Type type = Type.GetTypeFromProgID("Word.Application"); object comObject =…
tobias-kutter
  • 269
  • 2
  • 10