How to start Office pplication in Automation mode?

H

Hemilton Chen

Hi,
I am developing a COM Add-in by Working with the IDTExtensibility2 Event
Procedures, and find that from
MSDN(http://msdn2.microsoft.com/en-us/library/aa189748(office.10).aspx) there
are 3 ways to load the host application:
a),from the user interface (1).
b),by embedding a document created in the host application in another
application (2),
c), or through Automation (3).

My question is how to start an Office application(PPT, Excel, Word, etc.)
through Automation?

Here is an approach that i have found by now:
1), Insert Chart via PPT 2007 or Word 2007
In this case, the Excel 2007 will be loaded in Automation mode
 
A

Andrei Smolin [Add-in Express]

Hello Hemilton,

To start Excel via Automation, open any other Office application (say, Word)
and press Alt+F11; double-click ThisDocument and, in the code window, paste
the following code:

Sub StartExcel()
Dim excelApplication As Object
Set excelApplication = CreateObject("Excel.Application")
Stop
excelApplication.Visible = True
Stop
End Sub

This simple code assumes that Excel wasn't started. To run the code, set the
cursor cursor within the procedure, and press F5. Then the code launches
Excel and halts. By this time your add-in will have been loaded. If you
press F5 once again, the code makes Excel visible and you get a chance to
test your add-in in this scenario, too.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
We are at www.add-in-express.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top