TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
pravalika reddy
NA
15
18.5k
how to create and open and save excel sheet in vc++
Feb 9 2015 12:34 AM
please send me procedure of excel creation in vc++
this is my vc++ code
please help me
CString strFilename,stFileName;
//
Excel _Application;
COleVariant
covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
SYSTEMTIME sSystemTime;
GetSystemTime(&sSystemTime);
GetLocalTime(&sSystemTime);
stFileName.Format(_T("E:\\TEST%0.2d%0.2d%.4d%0.2d%0.2d%0.2d.xlsx"),sSystemTime.wDay,sSystemTime.wMonth,sSystemTime.wYear,sSystemTime.wHour,sSystemTime.wMinute,sSystemTime.wSecond);
theApp.stFileCreatedTime.Format(_T("%0.2d%0.2d%0.2d"),sSystemTime.wHour,sSystemTime.wMinute,sSystemTime.wSecond);
strFilename = _T("E:\\TEST.xlsx");
theApp.oBooks.Close();
theApp.app.Quit();
theApp.app= NULL;
//bExcelStartFlag = 1;
theApp.strAutoTestFilename = stFileName;
theApp.app.ReleaseDispatch();
// Start Excel and get Application object...
if(!theApp.app.CreateDispatch(_T("Excel.Application")))
{
AfxMessageBox(_T("Couldn't start Excel."));
}
else
{
//Make Excel Visible and display a message
//Get the Workbooks collection.
theApp.oBooks = theApp.app.GetWorkbooks();
// Excel 2003 takes 15 arguments
theApp.oBook = theApp.oBooks.Open(strFilename, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional);
theApp.oBook.SaveAs(COleVariant(stFileName),covOptional,covOptional,covOptional,covOptional,covOptional,0,covOptional,covOptional,covOptional,covOptional,covOptional);
}
Reply
Answers (
1
)
Static library and dynamic library distinction in C++?
All about polymorphism and How can I use that in C++?