473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

About Excel

A MFC project importing Excel9 lib
Sample Code:

CoInitialize(0);
IDispatch *pDisp=NULL;
::CoGetObject(L"c:\\a.xls",NULL,IID_IDispatch,(voi d ** )&pDisp);

if(!pDisp)
return;

_Workbook wb(pDisp);

Sheets sheets(wb.GetSheets());

_Worksheet ws(sheets.GetItem(_variant_t("sheet1")));

Range rg(ws.GetCells());

_bstr_t bs((rg.GetItem(_variant_t((long)1),_variant_t((lon g)2))));
////////I found rg.GetItem cause the error
wb.Close(_variant_t(false),_variant_t(),_variant_t ());
/////// Excel.exe show a error message

the Excel.exe show a error message after "wb.Close" is Excuted.
I found "rg.GetItem" cause the error.how to correct it.

I am not good at writing in English. Thank you.
Nov 17 '05 #1
0 838

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Huang | last post by:
Hi: When I use the Excel.Application object in window 2000 Advanced Server, I have the following issue '------------------------------------------get excel template file 'create excel...
6
by: Terrell Miller | last post by:
I am developing an Access/SQL2k app for a science lab. One of the lab folks asked me this, and I don't know the answer: Is it possible to do simple, straight-line trends somehow in Access...
4
by: Kalaora luc | last post by:
I transfert data in a Excel File. I want that the border of the cell in Excel have only left and right border. if i do : range.Columns.Borders.LineStyle=Excel.XlLineStyle.xlContinuous; My...
1
by: ʹÃûÑï | last post by:
hi: purpose: clone the firest sheet in Excel.xls into excel2.xls here is my code it well done in winform£º ------------------------------- string SubFile=@"D:\Excel2.xls"; string...
2
by: Brent | last post by:
Ok this is driving me nuts.. I add a com reference to the excel 11.0 library and throw this in Dim oXL As Excel.Application Dim oWB As Excel.Workbook Dim oSheet As Excel.Worksheet Dim oRng...
16
by: LP | last post by:
Hello, I am trying to use .NET with Excel. I installed Office 2003 and selected ..NET programming suport option, so it installed all those PIA, as MS sugests. But I can not find a way to destroy...
2
by: zhangyl | last post by:
I am running a instance of microsoft excel, and then I use the webBrowser to open an excel file in my owner application, but now, the existed instance of microsoft excel can't run, but I can run a...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
2
by: Eric | last post by:
Hi, i'm experientating with object StreamWriter in asp.net. This code works: the string is written to an excel sheet, but i have a questions about it: how does asp.net know the string must be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.