LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default excel 2003 and c++ API documentation?

I have been looking for documentation - any documentation or better yet, real
code examples regarding the c++ objects and methods for excel 2003. My
progress has been based on reverse engineering and guessing so is quite slow.
Help!

My purpose is exceptionally simple, to read (only, not write or format) data
from excel workbooks/worksheets.

I have a c++ MFC DLL project and have created excel classes from the type
library (actually .../EXCEL.EXE). The trouble really starts there - the
imported classes won't compile without some hand editing (Is that expected?).

After some "fixing," I can start the app with the following code:
if(!app.CreateDispatch(L"Excel.Application"))
{
//...todo - add error handling and cleanup
return;
}
else
{
//Make the app visible and verify the name - just for kicks!
COleVariant covOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
app.put_Visible(TRUE);
app.put_UserControl(TRUE);
CString appName = app.get_Name();
...
}

But that's where I'm stuck. I can't open an existing workbook because I
don't know what to supply for the workbook methods to open an existing
workbook. Brining up any of the dialogs (such as app._FindFile()) control is
transferred to the app (away from my DLL) and is not returned until I dismiss
the dialog manually. Needless to say, that's definitely not useful....

Here's the code I'm currently playing with:

COleVariant covOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
ExcelWorkbooks excelWBs = app.get_Workbooks();
ExcelWorkbook excelWB;
appName = app.get__Default();
ExcelParameter excelParam = excelWBs.get__Default(COleVariant((short)2));
excelWBs.Add(_T(".\\ExcelExample.xls"),covOptional , (ExcelParameter
**)&excelParam);


I've gotten this far by reverse engineering and poking around on Google --
VERY FRUSTRATING to spend several hours to get 10 lines of code for something
so trivially simple.

The VB and C# examples are plentiful and I can make those work easily. But
for many reasons this has to be a C++ project.

If could point me to any c++ code examples or documentation I would be
greatly relieved! ;-)

Thanks in advance.

dan

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is documentation for the C# Office XP/2003 Primary Interop Assemblies??? Stefani[_2_] Excel Programming 7 April 2nd 05 03:47 AM
Documentation of Excel 2003 objects Ken Ellis[_2_] Excel Programming 5 November 18th 04 01:01 PM
Excel Notation for Documentation? Pookie Excel Programming 3 August 12th 04 03:30 PM
Look up VBA documentation using Excel Help Wellie Excel Programming 2 June 8th 04 11:20 PM
Excel Object Documentation Chris Excel Programming 1 January 16th 04 04:13 AM


All times are GMT +1. The time now is 09:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"