open file excel ole automation visual studio c++

hi,

i´m trying to open a excel file using ole automation, passin with char * the name.
what am I doing wrong???
thank you

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void ExcelOpen(char * FileOpenName){
...

{
		VARIANT result;
		VariantInit(&result);
		VARIANT fname;
		fname.vt = VT_BSTR;
		fname.bstrVal=::SysAllocString(L"FileOpenName");
		AutoWrap(DISPATCH_METHOD, &result, pXlBooks, L"Open", 1, fname);
		pXlBook = result.pdispVal;
	}

}
Last edited on
It's quite straight forward to instantiate an instance of Excel via COM and add new Worksheets etc, but you actually want to load an existing Excel file do you? Are you wanting to use the Excel type library, if so which one, or just use pure COM to do what you need to do? Some further information on what you are intending to do with the Workbook once you've loaded it would be handy to know.
Topic archived. No new replies allowed.