|
Hi,
I getting the above return code the following is my code sequence
CLSID clsid;
HRESULT hr = CLSIDFromProgID(L"Excel.Application",&clsid)
IDispatch *pWApp;
hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&pWApp);
LPOLESTR ptName = (LPOLESTR) _T("OpenText");
DISPID dispID;
hr = pWApp->GetIDsOfNames(IID_NULL, &ptName, 1 , LOCALE_USER_DEFAULT,&dispID);
I am using VIsual C++ 6.0 excel 2003
Thanks
|
|
|
|
|
For CoInitialize I am getting a 0x00000001 S_FALSE (already initliazed)
For CLSIDFromProgID I am getting a 0x00000000 S_OK
For CoCreateInstance I am getting a 0x00000000 S_OK
For GetIDsOfNames I am getting a 0X80020006 DISP_E_UNKNOWNNAME
Thanks
|
|
|
|
|
I have tried this code with a variety of names (supposedly in Excel) but get the same response each time. The MSDN documentation is not very helpful so I'm not sure where to go from here. However, once again I would ask, what problem are you actually trying to solve?
|
|
|
|
|
I just tried again with the name "worksheets" and it worked. So, the code is correct, but the name you are using is not.
|
|
|
|
|
Very good you are right on the key is the first paramter
_In_ LPCOLESTR lpszProgID,
The Class id name, Excel is divded into for objects Application, Workbook, Worksheet, and I think Range
In Visual C++ 6.0 there is a OLE/COM viewer which might kind a hint of the names
What I am trying to do,
My boss gave me an assignment to automate the pasting of .txt file onto a Excel Worksheet
I wanted this app to be MFC based as I might need to employ windows services
Hence the main thread CWinApp and associated mainwindow
Thanks again for your help
|
|
|
|
|
|
|
I am going to go with the method you pointed out had using AS i GET BY THE
DISP_E_UNKNOWN
Maybe the way excel was installed it ddn't make entries
for HKCR\Typlib for the excel methods properties
Thanks
|
|
|
|
|
|