Click here to Skip to main content
15,916,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: If I want to achive the SMTP protocol, how can I do Pin
Moak1-Sep-10 5:24
Moak1-Sep-10 5:24 
QuestionDate Pin
Bijo Pulikkottil1-Sep-10 2:19
Bijo Pulikkottil1-Sep-10 2:19 
AnswerRe: Date Pin
Cedric Moonen1-Sep-10 2:38
Cedric Moonen1-Sep-10 2:38 
AnswerRe: Date Pin
Cool_Dev1-Sep-10 2:45
Cool_Dev1-Sep-10 2:45 
GeneralRe: Date Pin
Bijo Pulikkottil1-Sep-10 3:20
Bijo Pulikkottil1-Sep-10 3:20 
GeneralRe: Date Pin
Cedric Moonen1-Sep-10 3:22
Cedric Moonen1-Sep-10 3:22 
QuestionRe: Date Pin
David Crow1-Sep-10 4:30
David Crow1-Sep-10 4:30 
QuestionError :: 0x800706F7 "the stub received bad data" in Excel Automation. Pin
Le@rner1-Sep-10 1:07
Le@rner1-Sep-10 1:07 
Hi all,

i m using to Excel automation to read and write excel files.

i write excel file like this.
CoInitialize(NULL);
{
    Excel::_ApplicationPtr XL;
    HRESULT hr;
    try
    {
        XL.CreateInstance(L"Excel.Application");

        // create workbook & worksheet
        // identify range to which array will be assigned

        _variant_t var((long)DISP_E_PARAMNOTFOUND,VT_ERROR);

        XL->Workbooks->Add(Excel::xlWorksheet);
        Excel::_WorksheetPtr pSheet = XL->ActiveSheet;

        Excel::RangePtr pRange = pSheet->Cells;//on this line error is occur

        Excel::RangePtr pBeginRange = pRange->Item[1][1];
        Excel::RangePtr pEndRange = pRange->Item[1][1];
        Excel::RangePtr pTotalRange = pSheet->Range[(Excel::Range*)pBeginRange][(Excel::Range*)pEndRange];

        // create some BSTRs
        wchar_t wsz1[] = L"C";
        wchar_t wsz2[] = L"D";
        BSTR bstr1;
        bstr1 = SysAllocString(wsz1);

        BSTR bstr2;
        bstr2 = SysAllocString(wsz2);

        // create safearray
        SAFEARRAYBOUND rgsabound[2] = { 0 };
        rgsabound[0].cElements = 1; // num rows
        rgsabound[0].lLbound = 0; // lower bound
        rgsabound[1].cElements = 1; // num cols
        rgsabound[1].lLbound = 0; // lower bound

        VARIANT arr;
        arr.vt = VT_ARRAY | VT_BSTR;
        arr.parray = SafeArrayCreate(VT_BSTR,2,rgsabound);
        // identify index we want to change
        long index[2];
        // modify first element <0,0>
        index[0] = 0;
        index[1] = 0;
        hr = SafeArrayPutElement(arr.parray,index,bstr1);


        // assign safearray to range
        pTotalRange->PutValue2(&arr);
        // cleanup
        VariantClear(&arr);
        SysFreeString(bstr1);
        SysFreeString(bstr2);

        XL->Visible = true;

    }
    catch(_com_error &error)
    {
        cout << "COM error " << endl;
    }
}
CoUninitialize();

when i write excel file i received this error
0x800706F7 

"the stub received bad data" 


please tell me how can i solve it.

thanks in advance.
RantRe: Error :: 0x800706F7 "the stub received bad data" in Excel Automation. Pin
Cool_Dev1-Sep-10 2:37
Cool_Dev1-Sep-10 2:37 
GeneralRe: Error :: 0x800706F7 "the stub received bad data" in Excel Automation. Pin
Le@rner2-Sep-10 0:23
Le@rner2-Sep-10 0:23 
QuestionCannot create DSN name Pin
raju_shiva1-Sep-10 0:49
raju_shiva1-Sep-10 0:49 
QuestionRe: Cannot create DSN name Pin
CPallini1-Sep-10 2:09
mveCPallini1-Sep-10 2:09 
AnswerRe: Cannot create DSN name Pin
raju_shiva1-Sep-10 18:10
raju_shiva1-Sep-10 18:10 
GeneralRe: Cannot create DSN name Pin
CPallini1-Sep-10 21:21
mveCPallini1-Sep-10 21:21 
GeneralRe: Cannot create DSN name Pin
raju_shiva2-Sep-10 0:11
raju_shiva2-Sep-10 0:11 
GeneralRe: Cannot create DSN name Pin
CPallini2-Sep-10 0:38
mveCPallini2-Sep-10 0:38 
GeneralRe: Cannot create DSN name Pin
raju_shiva2-Sep-10 1:45
raju_shiva2-Sep-10 1:45 
GeneralRe: Cannot create DSN name Pin
CPallini2-Sep-10 2:11
mveCPallini2-Sep-10 2:11 
GeneralRe: Cannot create DSN name Pin
raju_shiva2-Sep-10 19:00
raju_shiva2-Sep-10 19:00 
QuestionStore a point within rect Pin
mesajflaviu1-Sep-10 0:37
mesajflaviu1-Sep-10 0:37 
AnswerRe: Store a point within rect Pin
CPallini1-Sep-10 0:48
mveCPallini1-Sep-10 0:48 
Questiontypdef struct MFC [modified] Pin
mesajflaviu31-Aug-10 20:45
mesajflaviu31-Aug-10 20:45 
AnswerRe: typdef struct MFC Pin
Eugen Podsypalnikov31-Aug-10 21:02
Eugen Podsypalnikov31-Aug-10 21:02 
GeneralRe: typdef struct MFC Pin
mesajflaviu31-Aug-10 21:15
mesajflaviu31-Aug-10 21:15 
GeneralRe: typdef struct MFC Pin
CPallini31-Aug-10 21:26
mveCPallini31-Aug-10 21:26 

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.