Click here to Skip to main content
15,891,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
How I do it :-
COleVariant varOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant varCount((short)(2),VT_I2); //
COleVariant varType((short)xlWorksheet,VT_I2); //-4167
pdispatch = m_excel_worksheets.Add(varOptional/*Before*/,varOptional/*After*/,varCount,varType);
pdispatch->Release();

Fitted to your code, ( I think this will work given the quick comparison I did of your AutoWrap_Exp and MFC's InvokeHelper ) :-
IDispatch* pXlSheet2;
VARIANT optional;
result.vt = VT_ERROR;
result.lVal = (long)DISP_E_PARAMNOTFOUND;
VARIANT count;
count.vt = VT_I2;
count.iVal = 2; // number of sheets to add
VARIANT type;
type.vt = VT_I2;
type.iVal = -4167;
VARIANT result;
VariantInit(&result);
AutoWrap_Exp(DISPATCH_METHOD, &result, pXlSheets, L"Add", 4, optional, optional, count, type);
result.pdispVal->Release();

Access the extra sheets as before using propertyget "Item". Using optional for both Before and After means, if I recall correctly, the 2 new sheets are added to the end of the sheets collection.
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 
AnswerRe: Something really crazy Pin
Richard MacCutchan6-Mar-11 22:29
mveRichard MacCutchan6-Mar-11 22:29 
GeneralRe: Something really crazy Pin
csrss7-Mar-11 0:38
csrss7-Mar-11 0:38 

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.