Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fastest file writing Pin
John M. Drescher21-Jul-03 6:06
John M. Drescher21-Jul-03 6:06 
GeneralVisual C++ (Updating versions) Pin
ttran770021-Jul-03 2:53
ttran770021-Jul-03 2:53 
GeneralWizard sheet Banner Pin
Member 42425921-Jul-03 2:40
Member 42425921-Jul-03 2:40 
QuestionLarge Exponents? Pin
Selevercin21-Jul-03 2:39
Selevercin21-Jul-03 2:39 
AnswerRe: Large Exponents? Pin
G. Steudtel21-Jul-03 4:42
G. Steudtel21-Jul-03 4:42 
GeneralRe: Large Exponents? Pin
Selevercin21-Jul-03 16:08
Selevercin21-Jul-03 16:08 
GeneralExcel automation question Pin
Hadi Rezaee21-Jul-03 2:30
Hadi Rezaee21-Jul-03 2:30 
GeneralRe: Excel automation question Pin
Manfred Staiger21-Jul-03 3:05
Manfred Staiger21-Jul-03 3:05 
Try the following code to work with an existing Excel file.
Hope that's what you need.


_Application m_app;

Workbooks m_workbooks;
_Workbook m_workbook;

Worksheets m_worksheets;
_Worksheet m_worksheet;


COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covTrue((short)TRUE);
COleVariant covFalse((short)FALSE);



m_app.CreateDispatch("Excel.Application");
m_workbooks = m_app.GetWorkbooks();

m_workbook= m_workbooks.Open("path_To_Your_Excel_File",
VOptional, covTrue, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional );

//Make Excel visible if you like
m_app.SetVisible(TRUE);


m_worksheets=m_workbook.GetWorksheets();

//Choose the sheet you want to work with
for(int i=1;im_worksheets.GetCount()+1;i++)
{
m_worksheet = m_worksheets.GetItem(COleVariant((short) i));
sheetName=m_worksheet.GetName();
if(sheetName=="name_of_a_sheet_in_your_excel_file")
{
break;
}
}

MS
GeneralRe: Excel automation question Pin
Hadi Rezaee23-Jul-03 10:10
Hadi Rezaee23-Jul-03 10:10 
GeneralSpeech Recognition Pin
superstein21-Jul-03 2:30
superstein21-Jul-03 2:30 
GeneralRe: Speech Recognition Pin
Bob Stanneveld21-Jul-03 8:52
Bob Stanneveld21-Jul-03 8:52 
GeneralRe: Speech Recognition Pin
superstein22-Jul-03 4:41
superstein22-Jul-03 4:41 
Generalclose IE window!!! Pin
xxhimanshu21-Jul-03 1:47
xxhimanshu21-Jul-03 1:47 
GeneralRe: close IE window!!! Pin
Bob Stanneveld21-Jul-03 9:03
Bob Stanneveld21-Jul-03 9:03 
GeneralDuplicate Dialogs Pin
Jay Hova21-Jul-03 1:32
Jay Hova21-Jul-03 1:32 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 1:48
Ryan Binns21-Jul-03 1:48 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 2:47
Jay Hova21-Jul-03 2:47 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 2:55
Ryan Binns21-Jul-03 2:55 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 3:18
Jay Hova21-Jul-03 3:18 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 3:26
Ryan Binns21-Jul-03 3:26 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 3:39
Jay Hova21-Jul-03 3:39 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 3:40
Ryan Binns21-Jul-03 3:40 
GeneralRe: Duplicate Dialogs Pin
G. Steudtel21-Jul-03 3:34
G. Steudtel21-Jul-03 3:34 
GeneralRe: Duplicate Dialogs Pin
Jay Hova22-Jul-03 9:42
Jay Hova22-Jul-03 9:42 
QuestionHow to disable CD ROM autoplay function? Pin
HansonDavid21-Jul-03 1:15
HansonDavid21-Jul-03 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.