pia

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

安稳与你 提交于 2020-01-20 02:43:36
问题 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 ApplicationClass(); The PIA's version specifically refers to it as Excel 12. C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll But: excel.Version;//this is 11.0 instead of 12.0 Thus, when I try to open a

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

拟墨画扇 提交于 2020-01-20 02:43:05
问题 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 ApplicationClass(); The PIA's version specifically refers to it as Excel 12. C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll But: excel.Version;//this is 11.0 instead of 12.0 Thus, when I try to open a

C# interop: excel process not exiting after adding new worksheet to existing file [duplicate]

江枫思渺然 提交于 2020-01-12 05:11:20
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to properly clean up Excel interop objects in C# I've read many of the other threads here about managing COM references while using the .Net-Excel interop to make sure the Excel process exits correctly upon exit, and so far the techniques have been working very well, but I recently came across a problem when adding new worksheets to an existing workbook file. The code below leaves a zombie Excel process. If

Visual Studio 2010: Embed Interop Types

时光毁灭记忆、已成空白 提交于 2019-12-22 03:50:11
问题 I found some information about this on Scott Hanselmans Blog Does anybody exactly know what this mean? Is this only for the Office Primary Interop Assemblies, or can I also use this to Embed my Redemption library or other COM libraries? 回答1: The process described in Scott Hanselman's blog is called Type Equivalence , a rather nebulous term for the CLR 4.0's support for COM interop type assemblies. Although I haven't had a chance to look at it, there is a video here at Channel 9 that discusses

Extracting Source Code from an MS Access DB

做~自己de王妃 提交于 2019-12-21 02:53:14
问题 I have an Access DB that I would like to extract the source code from so I can put it into Source control. I have tried to extract the data using the Primary Interop Assemblies(PIA), but I am getting issues as it is not picking up all of the modules and forms. There are 140 Forms and Modules in the code(Don't ask, it's a legacy system I have inherited) but the PIA code is only picking up 91 of them. Here is the code I am using. using System; using Microsoft.Office.Interop.Access; namespace

Set Current Directory in Excel.Application via .NET Office PIA

风流意气都作罢 提交于 2019-12-11 08:44:37
问题 I want to create an Excel spreadsheet from a .NET Application and then set the Excel.Application instance current directory to a custom folder. I want to do this so when the user clicks the save button in Excel, the Save as dialog is already located in the correct directory. I know it's possible to change the current directory in Excel Instance with VBA.FileSystem.ChDir and doing it within the Excel.Application instance with VBA Code/Macro like this: Create an Excel Spreadsheet from C# .NET

Move to next cell in the next row in excel using c#

拈花ヽ惹草 提交于 2019-12-10 20:33:12
问题 How can I move to the next row in Excel using C#. I'm using Office PIA v 14. When I used Range.Next property, it takes me to the cell immediately right to the range. How can I move to the next row? ie. the cell immediately below. 回答1: Range.Next returns a Range object that represents the next cell . I'm not really the greatest expert alive but according to the documentation you should use Offset instead. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.offset Here

Automating Excel through the PIA makes VBA go squiffy

不打扰是莪最后的温柔 提交于 2019-12-08 04:34:25
问题 I have absolutely no idea how to start diagnosing this, and just wondered if anyone had any suggestions. I'm generating an Excel spreadsheet by calling some Macros from a C# application, and during the generation process it somehow breaks. I've got a VBA class containing all of my logging/error-handling logic, which I instantiate using a singleton-esque accessor, shown here: Private mcAppFramework As csys_ApplicationFramework Public Function AppFramework() As csys_ApplicationFramework If

Visual Studio 2010: Embed Interop Types

末鹿安然 提交于 2019-12-05 01:28:04
I found some information about this on Scott Hanselmans Blog Does anybody exactly know what this mean? Is this only for the Office Primary Interop Assemblies, or can I also use this to Embed my Redemption library or other COM libraries? The process described in Scott Hanselman's blog is called Type Equivalence , a rather nebulous term for the CLR 4.0's support for COM interop type assemblies. Although I haven't had a chance to look at it, there is a video here at Channel 9 that discusses it: Raja Krishnaswamy and Vance Morrison: CLR 4 - Inside Type Equivalence http://channel9.msdn.com/shows