Questions tagged [office-automation]

Use this tag for questions related to automating MS Office Products ( Excel, Outlook, PowerPoint, Access, Word, Project, etc. ). Automation in this context means the use of an external software, not an MS Office product, to execute a variety of operations on MS Office products. For questions about macros use the relevant tags for example "excel" and "vba". Do not use this tag if your question is not about automatic control.

Automation in this context means the use of computer systems to execute a variety of operations such as word processing, spreadsheet calculation, database manipulation, etc. without user interruption.

If you have a specific programming question about Excel or Word (or any other product from the MS Office package) and it is not about automating it via external software then use tags like , , , etc.

805 questions
25
votes
5 answers

Excel 2007 automation on top of a Windows Server 2008 x64

I’m well aware of the Microsoft support base article stating that it’s not supported to automate office products UI less. It seems that Windows Server 2008 x64 and Excel 2007 enforce the given statement. I’m running the following code in a NT…
Chris Richner
  • 2,863
  • 2
  • 26
  • 38
12
votes
4 answers

Running an Excel Macro via C#: Run a macro from one workbook on another?

I am looking to run a macro, let's call it Macro01 from WorkSheet01 on WorkSheet02. Using Microsoft.Office.Interop.Excel Namespace I have opened a WorkSheet01. public void Main_CodedStep() { // Object for missing (or optional)…
kirbycope
  • 521
  • 2
  • 9
  • 24
10
votes
1 answer

Search and replace in OLE Word automation - how to cover header and footer?

I've a perfectly working function to find and replace a variable with text in word documents. HRESULT CMSWord::FindReplace( CString szVar, CString szText, bool bOnlyOnce/*=false*/ ) { if(m_pWApp==NULL || m_pActiveDocument==NULL) return E_FAIL; …
masche
  • 1,643
  • 2
  • 14
  • 24
9
votes
13 answers

Killing EXCEL.exe Process from C# in a Windows Service

I have a windows service that opens up an Excel spreadsheet via the Microsoft.Office.Interop.Excel.Application object. Application xlApp = new Application(); Workbook workbook = xlApp.Workbooks.Open(fileName, 2,…
thiag0
  • 2,199
  • 5
  • 31
  • 51
8
votes
4 answers

how to close a running instance of Word document? (C#)

I could see a lot of very similar threads all around, but nothing seem to give me a solution which ought to be very basic. From my winforms application, I need to close a running instance of a word document (opened from the application itself). When…
nawfal
  • 70,104
  • 56
  • 326
  • 368
8
votes
5 answers

Programmatically combine slides from multiple presentations into a single presentation

I need to automate the creation of a presentation (either OpenOffice or Powerpoint). The presentation should take the first two slides of each of the presentations in a given directory, and then combine them into a single presentation. I'm confused…
8
votes
3 answers

reasons why excel.exe remains loaded after running a delphi client automation program?

I wrote a Delphi program that extracts and consolidates data from several different spreadsheets of a single .XLS file, to a text file for later processing. It is a Delphi 7 console program. An excerpt of the most relevant pieces of code will show…
PA.
  • 28,486
  • 9
  • 71
  • 95
7
votes
4 answers

Getting a Object Reference error in prod only when trying to use the Word DocumentClass

I am writing a program that uses a .dotx template and does a merge of data in an aspx page. The program works perfect on my Dev workstation locally but when I deploy it to a test IIS server, it fails on the second line below giving me an Object…
RJ.
  • 3,173
  • 4
  • 35
  • 44
7
votes
2 answers

Multiple InfoPath interop automation instances

I am trying to automate multiple parallel instances of Office InfoPath 2010 via a windows service. I understand automating Office from a service is not supported however it is a requirement of my customer. I can automate other Office applications…
6
votes
1 answer

Copy Excel Worksheet from one Workbook to another with Powershell

I'd like to copy (or move) a worksheet from one workbook to another workbook with Powershell. I had done this before and cant remember how. I think I used CopyTo() function. Just to get started. $missing = [System.Type]::missing $excel = New-Object…
idazuwaika
  • 2,749
  • 7
  • 38
  • 46
6
votes
0 answers

Using the FormattedText property of MS Word rather than the clipboard to pass RTF text to Word

I want to spell/grammar check the content of a TDBRichEdit component using Word automation (early binding) while preserving the RTF-formatting of the source during the process. The obvious way of doing it is to use the Clipboard as…
gtro
  • 65
  • 6
6
votes
8 answers

How to generate report in word 2010 using c# , dot net, word templates, xml

We have a database application that stores data that we want to report in Microsoft Word. Suppose all information of my customers is stored on a database system and I am now requested to create hundreds of word letters, reports that will be sent to…
learning
  • 11,415
  • 35
  • 87
  • 154
6
votes
1 answer

"Call Rejected By Callee"

We're in the process of moving a slew of our applications from Windows XP to Windows 7 and have run into an old problem with Word Automation. We had an issue in one of our applications where we would get "Call rejected by Callee" when trying to…
Dan Kelly
  • 2,634
  • 5
  • 41
  • 61
5
votes
2 answers

Office Primary Interop Assemblies not working after installing 2007 compatibility pack

I had a C# program that did some Word & Excel automation and it used Office 2003 Primary Interop Assemblies. The way I deployed it was by including the Interops in the bin and I had my program reference it from there as opposed to referencing it…
zfeld75
5
votes
1 answer

Dir Function in Excel 2010 VBA not working

I am trying to loop through a given directory to find the latest downloaded csv file. For some reason my Dir function won't find any file even if the file does exist. I am not totally familiar with VBA so i may perhaps be missing some sort of…
derigible
  • 964
  • 5
  • 15
  • 32
1
2 3
53 54