CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2017
    Posts
    3

    [RESOLVED] C++ MFC Automation has recently started to fail (on some machines)

    We are working in Visual Studio C++ (MFC)

    Our program has Excel Automation code that has worked for over 15 years but on just a few machines we are suddenly getting Automation exceptions and we cannot figure it out.

    // m_ExcelBooks is a Workbooks class and appears to be valid before the call
    VERIFY(lpDisp=m_ExcelBooks.Add(COleVariant(Program().m_dataTransfer.m_templateName)));



    Then we get an error message
    “Add method of workbooks class failed”

    (The template does exist and will load into Excel if I do it manually from Excel)

    I’ve tried re-installing our software, no joy
    I’ve tried repairing and re-installing Office, no joy
    I've traced it through with the Debugger and everything seems OK before the call.

    The only time I got anywhere was to install a copy of Office 2007 and force XLT files to open with that and it bypassed the Office 2016 version that was failing.

    This makes me think that something has been messed up in the way Windows ‘automates’ Excel.

    It's very strange that on most systems this still works but on a few this problem has cropped up.

    If anyone has any ideas they would be much appreciated

    Many thanks in advanced
    Phil C.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: C++ MFC Automation has recently started to fail (on some machines)

    Well, just a guess...
    if it has first happened after the Windows Update of 12.10.2017 then you should have to uinstall some of the Updates (depending on your system): for Windows 7 there are KB4041681, KB4041678.
    See also https://www.google.ch/search?q=80004...hrome&ie=UTF-8
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2017
    Posts
    3

    Re: C++ MFC Automation has recently started to fail (on some machines)

    Thanks for the reply

    At the moment I am writing some test code around our current program to see if Automation works


    It does from VBS and a fresh MFC so it must be something we are doing

  4. #4
    Join Date
    Oct 2017
    Posts
    3

    Re: C++ MFC Automation has recently started to fail (on some machines)

    Problem solved.



    It was a badly handled exception - strange that the code had worked perfectly for nearly 20 years!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured