VisualStudio 2017 ClassWizard cannot get SmartDocument object from Microsoft Excel 2007 or 2010 type library RRS feed

  • Question

  • Hi, I have asked this question yesterday:

    Cannot get Excel Workbook's SmartDocument object from the type library or registry for Excel 2007 and 2010

    I have MFC automation project for Excel 2003 using Excel9.h, Excel9.cpp.

    These files contain SmartDocument class which I use as there:

    _Application oApp.CreateDispatch("Excel.Application");

    Workbooks oBooks =oApp.GetWorkbooks();

    _Workbook oBook = oBooks.Open(szFileName,...);

    SmartDocument oDoc = oBook.GetSmartDocument();

    oDoc.SetSolutionID("{My solution ClassId}");

    I am trying now to develop the analogous project for Excel 2007 or 2010

    but I cannot get Excel Workbook's SmartDocument object from the type library or registry.

    There is SmartDocument property in CWorkbook class but I cannot use it

    to set solution ID because SmartDocument class absebce.

    I received this reply:

    Hi Mik,

    You could use oBook.smartdocument to get the SmartDocument object, and then set the ID by the

    SolutionID property of the SmartDocument object.

    Please see the following link:

    SmartDocument Interface

    Best Regards, Bruce

    This reply references the link, related to getting SmartDocument object from Excel 2003 type library,

    but I have no problem with getting SmartDocument from Excel 2003 type library. I have such code

    working during many years. My problem is to get SmartDocument from Excel 2010. ClassWizard

    permit to extract CApplication, CWorkbooks, CWorkbook,.., but it does not permit extract CSmartDocument.

    I need your help.

    Monday, December 10, 2018 12:38 PM