D
David
Hi,
I am now using C++ and Powerpoint automation interface to create a
powerpoint file and save it. That works fine. Now, I want open that document
with Powerpoint when the file is successfully created.
I am coding like the following:
------------------------------------------------------------------------
// Get DISPID for the Open method on the Presentations collection object
szFunction = OLESTR("Open");
hr = pDispPrsCol->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_PrsColOpen);
VARIANT vArgsOpen[1];
DISPPARAMS dpOpen;
vArgsOpen[0].vt = VT_BSTR;
vArgsOpen[0].bstrVal = bstrTemp;
dpOpen.cArgs = 1;
dpOpen.cNamedArgs = 0;
dpOpen.rgvarg = vArgsOpen;
// Open the saved Powerpoint presentation by invoking the open method
hr = pDispPrsCol->Invoke(dispid_PrsColOpen, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, &dpOpen, NULL, &excep, NULL);
if(FAILED(hr)) OLEErrHandler(hr, excep);
::SysFreeString(bstrTemp);
--------------------------------------------------------------------------
But the program gives error message:
Run-time error: Presentations.Open: Invalid request. The Powerpoint frame
window does not exist.
So, from the error message, I guess I need to launch Powerpoint main frame
window first.
Can anyone let me know how to launch Powerpoint main frame window?
Thanks a lot!
I am now using C++ and Powerpoint automation interface to create a
powerpoint file and save it. That works fine. Now, I want open that document
with Powerpoint when the file is successfully created.
I am coding like the following:
------------------------------------------------------------------------
// Get DISPID for the Open method on the Presentations collection object
szFunction = OLESTR("Open");
hr = pDispPrsCol->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_PrsColOpen);
VARIANT vArgsOpen[1];
DISPPARAMS dpOpen;
vArgsOpen[0].vt = VT_BSTR;
vArgsOpen[0].bstrVal = bstrTemp;
dpOpen.cArgs = 1;
dpOpen.cNamedArgs = 0;
dpOpen.rgvarg = vArgsOpen;
// Open the saved Powerpoint presentation by invoking the open method
hr = pDispPrsCol->Invoke(dispid_PrsColOpen, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, &dpOpen, NULL, &excep, NULL);
if(FAILED(hr)) OLEErrHandler(hr, excep);
::SysFreeString(bstrTemp);
--------------------------------------------------------------------------
But the program gives error message:
Run-time error: Presentations.Open: Invalid request. The Powerpoint frame
window does not exist.
So, from the error message, I guess I need to launch Powerpoint main frame
window first.
Can anyone let me know how to launch Powerpoint main frame window?
Thanks a lot!