本文介绍了如何自动化Excel以创建和格式化新工作簿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在按照本教程的步骤进行操作:http://support .microsoft.com/kb/308292/zh-CN
我使用Visual Studio 2005和Excel2007.
我在这部分有几个错误:
I´m following the steps of this tutorial: http://support.microsoft.com/kb/308292/en-us
I use Visual Studio 2005 and Excel 2007.
I have several errors in this part:
COleVariant
covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
CApplication app; // app is the Excel _Application object
CWorkbooks books;
CWorkbook book;
CWorksheets sheets;
CWorksheet sheet;
// Start Excel and get Application object.
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Cannot start Excel and get Application object.");
return;
}
else
{
//Get a new workbook.
books = app.get_Workbooks();
book = books.Add (covOptional);
//Get the first sheet.
sheets =book.get_Sheets();
sheet = sheets.get_Item(COleVariant((short)1));
错误C2039:添加":不是"CWorkbooks"的成员
错误C2039:"get_Sheets":不是"CWorkbook"的成员
错误C2039:"get_Item":不是"CWorksheets"的成员
你能帮助我吗??谢谢!!
error C2039: ''Add'' : is not a member of ''CWorkbooks''
error C2039: ''get_Sheets'' : is not a member of ''CWorkbook''
error C2039: ''get_Item'' : is not a member of ''CWorksheets''
Can you help me?? Thank you!!
推荐答案
这篇关于如何自动化Excel以创建和格式化新工作簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!