ole-automation

How to write a class library for OLE Automation?

I have Excel add-in which I add so many class modules that it is now very bulky. I want to convert it into a type library or a COM package so that I can re-use it for the other apps in the MS Office suite. I ported the add-in to Visual Studio as a class library project but Excel Automation doesn't recognize the classes in the compiled ....

Building MFC Automation example (to access Excel using OLE automation). Can't compile

I'm trying to build the example described at http://support.microsoft.com/kb/178749/EN-US/ in order to build an application that programatically accesses Excel using Automation. I have Visual C++ 2005/Visual Studio 2005. Some of the instructions don't exactly match up (classwizard, mostly), but the general idea seems to be the same. ...

Using Automation to get_Text from Excel. If cell too narrow, get #####. How can I avoid that?

I'm using Automation to get_Text from an Excel worksheet. I do this because I need the formatted value (getting the value of the cell doesn't apply any formatting). If the column the cell is in is too narrow, I get "#####" the same was I would if I were to look at the spreadsheet via Excel. How can I avoid that? EDIT: Here is the ...

What does the Excel VBA range.Rows property really do?

OK, I am finishing up an add-on project for a legacy Excel-VBA application, and I have once again run up against the conundrum of the mysterious range.Rows(?) and worksheet.Rows properties. Does anyone know what these properties really do and what they are supposed to provide to me? (note: all of this probably applies to the correspond...

OLE Automation basics with Perl

I'm new with this Perl Win32::OLE automation. I have been reading and trying out some examples. I have a few questions (excuse me if i'm using incorrect terminologies - do correct me): Can OLE be used to automate Visual Studio 2005? I only found examples with Word, Excel and IE. How do you know which app can be used? How do I get the n...

OLE automation - WORD tabels (Delphi)

Hi, I'm trying to make tables inside tables in WORD. of course in finall program it will be dinamical, which is not in this sample. Here is my sample code. var aTable, bTable, cTable : OLEVariant; begin m_WordApplication := CreateOleObject('Word.Application') ; m_WordDocument := m_WordApplication.Documents.Add; aTable := m_W...

From C#, open an arbitrary application

Related question [stackoverflow] here. I'm trying to do the above, but I want to take the process one step further. I want to open an arbitrary file using the default editor for the file type. From that point, I want to allow my user to interact with the file as they would normally, or continue to work in my application. The extension i...

Problem with format a single excel column with OLE automation using Delphi

Dear All, I have piece of code which I use to format a range of cells in Excel. It works fine in Excel 2007 but when the range is only 1 column wide and it is Excel 2003 instead of 2007, I'll get an error saying the I am assigning invalid value for a border's line style. ** valuables such as "xlInsideHorizontal", I have declared them a...

Is it possible to automate a Click-to-run application?

I have a small application which automates Microsoft Word via COM/OLE Automation. Unfortunately this doesn't work with the virtualized Click-to-run editions of Word, because they don't have the required keys in the registry. (At least not where they are exptected to be) In other words: CreateObject fails because the necessary COM classe...

.NET DateTime, different resolution when converting to and from OADate?

I'm converting a DateTime to OADate. I was expecting to get the exact same DateTime when converting the OADate back, but now it has only millisecond resolution, and is therefore different. var a = DateTime.UtcNow; double oadate = a.ToOADate(); var b = DateTime.FromOADate(oadate); int compare = DateTime.Compare(a, b); //Compare is not ...

OLE Automation to launch MS Word and bring to front

What is the "correct" (recommended) method for connecting to a running instance of MS Word and bringing this application to the front? I am doing something like the following from a VBA app: ... objWord = GetObject ("Word.Application") if (objWord is nothing) then objWord = CreateObject("Word.Application") end if objWord.Activate() ob...