Solved

Using MFC to access MSOffice Object Models

Posted on 1998-09-02
2
254 Views
Last Modified: 2013-11-25
Easy Question:
How do I use the Office Object Models from with in
Visual C++, it's dead easy under VB - any ideas ???
0
Comment
Question by:dd021197
  • 2
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1321597
It is as easy as VB with Visual C++ 5.0. Look into the Visual C++ 5.0 documentation: Visual C++\Visual C++ Programmer's Guide\Adding Program Functionality\Overviews\Compiler COM Support: Overview. And the Visual C++ Compiler COM Support Samples, especially "COMEXCEL: Demonstrates an Automation Client Application with Compiler COM Support".
0
 
LVL 23

Expert Comment

by:chensu
ID: 1321598
"COMEXCEL is a stand-alone Automation (formerly OLE Automation) client. It creates a new Microsoft Excel spreadsheet and generates a pie chart of the data stored on that spreadsheet. This sample works only with Microsoft Excel for Windows 95 version 7.0 or later, which exposes the dispinterfaces. It does not work with any previous versions of Microsoft Excel.

There is a Visual Basic project that controls the server in a way analogous to the COM code in Visual C++. You can compare the Visual Basic code with the code of this sample to see the similarities. You can use Visual Basic-specific object model documentation to write COM controllers in Visual C++.

To run this sample, you must edit the path to XL5EN32.OLB file in the source code.

This sample demonstrates the following keywords:

dispinterface; #import; _com_ptr_t; _variant_t; _bstr_t; _com_error."
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Doc'in system (example?) BA 7 115
centeredAverage challenge 8 178
Windows Process running 3 58
How and where to get Business Intelligence Development Studio? 2 91
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question