Solved

Using MFC to access MSOffice Object Models

Posted on 1998-09-02
2
252 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

785 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