> I have written some code in VC++
Can't help you with that
But maybe this page is useful for you
http://www.rondebruin.nl/saveas.htm
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Priyanka" <(E-Mail Removed)> wrote in message news:6A24A6F7-51B5-408A-9F5E-(E-Mail Removed)...
> HI everybody..........
>
> This is regarding the Excel API _Workbook::SaveAs.......
>
> I have written some code in VC++ to save any excel sheet at a particular
> place of my choice using my ExcelAddin.
>
> It works fine with office 2000/2003.
>
> Here it is,
>
>
> VARIANT vt_Format;
> VariantInit(&vt_Format);
> vt_Format.vt = VT_I4;
> vt_Format.lVal = GetFormat(nFormat);
>
> VARIANT vt_Optional;
> vt_Optional.vt = VT_ERROR;
> vt_Optional.scode = DISP_E_PARAMNOTFOUND;
> _bstr_t bstrFilePath(strFilePath.operator LPCTSTR());
> VARIANT vt_FilePath;
> VariantInit(&vt_FilePath);
> vt_FilePath.vt = VT_BSTR;
> vt_FilePath.bstrVal = bstrFilePath;
>
> try
> {
> CExcelDMSConnect::m_bFirstSave = TRUE;
>
> hr = pBook->SaveAs(vt_FilePath,
> t, -----------------------------XYZ
> vt_Optional, vt_Optional, vt_Optional,
> vt_Optional, xlNoChange, vt_Optional,
> vt_Optional, vt_Optional, vt_Optional, 0);
> CExcelDMSConnect::m_bFirstSave = FALSE;
> if(FAILED(hr))
> {
> AfxMessageBox(IDS_ERR_SAVEAS_DOC);
> return;
> }
> }
> catch(_com_error e)
> {
> _bstr_t description=e.Description();
> _bstr_t errmsg=e.ErrorMessage();
> CString strDes=OLE2T(description);
> CString strErrMsg=OLE2T(errmsg);
>
> }
>
>
> When i execute the line labelled
> "......................................XYZ", the _com_error exception is
> thrown by office API.
> When i look at Desription of the exception, it shows a null string and the
> Errormessage is "Unknown Error".
>
> I am using mso9.dll
>
> I don't know what is wrong with it and why this API fails...........
> Has the API for this purpose been changed??????????
>
>
> Any help would be appreciable.
>
> Thanks and Regards,
> Priyanka