Click here to Skip to main content
15,898,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionchange highlight color of ClistCtrl when it not in focus Pin
xanagan6666-Mar-11 23:34
xanagan6666-Mar-11 23:34 
AnswerRe: change highlight color of ClistCtrl when it not in focus Pin
Roger Broomfield7-Mar-11 0:35
Roger Broomfield7-Mar-11 0:35 
GeneralRe: change highlight color of ClistCtrl when it not in focus Pin
xanagan6667-Mar-11 4:47
xanagan6667-Mar-11 4:47 
GeneralRe: change highlight color of ClistCtrl when it not in focus Pin
Roger Broomfield7-Mar-11 12:53
Roger Broomfield7-Mar-11 12:53 
QuestionHow can write sheet 2 in xlsx with excel automation? Pin
Le@rner6-Mar-11 18:29
Le@rner6-Mar-11 18:29 
AnswerRe: How can write sheet 2 in xlsx with excel automation? Pin
Roger Broomfield7-Mar-11 1:34
Roger Broomfield7-Mar-11 1:34 
GeneralRe: How can write sheet 2 in xlsx with excel automation? Pin
Le@rner7-Mar-11 1:57
Le@rner7-Mar-11 1:57 
GeneralRe: How can write sheet 2 in xlsx with excel automation? Pin
Roger Broomfield7-Mar-11 4:36
Roger Broomfield7-Mar-11 4:36 
I use the Excel Dispatch Wrapper classes, which makes it much easier, this is exactly what I do in my own code
_Workbook           m_excel_workbook;
Worksheets          m_excel_worksheets;
_Worksheet          m_excel_worksheet;

// stuff happens here to add a new workbook just like you do

LPDISPATCH pdispatch;
LPCTSTR szSheetName = _T("name of sheet");
COleVariant varIndex((short)2);
pdispatch = m_excel_workbook.GetWorksheets();
if (pdispatch != NULL)
{
    m_excel_worksheets.AttachDispatch(pdispatch);
    pdispatch = m_excel_worksheets.GetItem(varIndex);
    if (pdispatch != NULL)
    {
        m_excel_worksheet.AttachDispatch(pdispatch);

        m_excel_worksheet.SetName(szSheetName);
    }
}

Trying to fit that to your code would look something like this, I think
IDispatch* pXlSheets;
VARIANT result;
VariantInit(&result);
AutoWrap_Exp(DISPATCH_PROPERTYGET, &result, pXlBook, L"Worksheets", 0);
pXlSheets = result.pdispVal;

IDispatch* pXlSheet2;
VARIANT item;
result.vt = VT_EMPTY;
result.pdispVal = NULL;
item.vt = VT_I4;
item.lVal = 2;
AutoWrap_Exp(DISPATCH_PROPERTYGET, &result, pXlSheets, L"Item", 1, item);
pXlSheet2 = result.pdispVal;

VARIANT name;
name.vt = VT_BSTR;
name.bstrVal = ::SysAllocString("name of your sheet");
AutoWrap_Exp(DISPATCH_PROPERTYPUT, NULL, pXlSheet2, L"Name", 1, name);

GeneralRe: How can write sheet 2 in xlsx with excel automation? [modified] Pin
Le@rner7-Mar-11 17:22
Le@rner7-Mar-11 17:22 
GeneralRe: How can write sheet 2 in xlsx with excel automation? Pin
Roger Broomfield7-Mar-11 20:34
Roger Broomfield7-Mar-11 20:34 
GeneralRe: How can write sheet 2 in xlsx with excel automation? [modified] Pin
Le@rner7-Mar-11 21:03
Le@rner7-Mar-11 21:03 
GeneralRe: How can write sheet 2 in xlsx with excel automation? Pin
Roger Broomfield7-Mar-11 21:30
Roger Broomfield7-Mar-11 21:30 
GeneralRe: How can write sheet 2 in xlsx with excel automation? [modified] Pin
Le@rner7-Mar-11 21:42
Le@rner7-Mar-11 21:42 
Questionencode char? Pin
Nguyen Sy Bang6-Mar-11 17:55
Nguyen Sy Bang6-Mar-11 17:55 
QuestionVS 2008 Configuration For Libraries Pin
Mike Certini6-Mar-11 17:53
Mike Certini6-Mar-11 17:53 
AnswerRe: VS 2008 Configuration For Libraries Pin
Michael Dunn6-Mar-11 18:12
sitebuilderMichael Dunn6-Mar-11 18:12 
GeneralRe: VS 2008 Configuration For Libraries Pin
Mike Certini6-Mar-11 18:31
Mike Certini6-Mar-11 18:31 
GeneralRe: VS 2008 Configuration For Libraries Pin
tagopi6-Mar-11 19:53
tagopi6-Mar-11 19:53 
GeneralRe: VS 2008 Configuration For Libraries Pin
Mike Certini8-Mar-11 5:43
Mike Certini8-Mar-11 5:43 
QuestionSomething really crazy Pin
csrss6-Mar-11 15:03
csrss6-Mar-11 15:03 
AnswerRe: Something really crazy Pin
Hans Dietrich6-Mar-11 15:51
mentorHans Dietrich6-Mar-11 15:51 
AnswerRe: Something really crazy Pin
Emilio Garavaglia6-Mar-11 21:23
Emilio Garavaglia6-Mar-11 21:23 
QuestionRe: Something really crazy Pin
CPallini6-Mar-11 21:44
mveCPallini6-Mar-11 21:44 
AnswerRe: Something really crazy Pin
Emilio Garavaglia7-Mar-11 4:10
Emilio Garavaglia7-Mar-11 4:10 
GeneralRe: Something really crazy Pin
csrss7-Mar-11 0:47
csrss7-Mar-11 0:47 

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.