none
CLSIDFromProgID(L"Excel.Application", &clsid) fails RRS feed

  • Question

  • Using C++ MFC I've always used the call

    CLSIDFromProgID(L"Excel.Application", &clsid)

    to get hold of the Excel application. On my old Windows 10 machine this worked. Now on a new Windows 10 machine, which also hask Excel it no longer works.

    I've found Excel.Exe on my machine, so it should work...

    TIA!


    http://www.ransen.com Cad and Graphics software


    • Edited by Owen Ransen Saturday, March 23, 2019 1:10 PM
    Saturday, March 23, 2019 9:06 AM

Answers

  • Well, solved. I copied two Excel branches from HKCR\Excel.Application and HKCR\Excel.Application.16 from the Win 10 computer which worked to the one which didn't. Now my program accesses Excel as it should. What happened I have no idea.


    http://www.ransen.com Cad and Graphics software

    • Marked as answer by Owen Ransen Thursday, March 28, 2019 7:04 AM
    Thursday, March 28, 2019 7:04 AM

All replies

  • Can you tell,

    what exactly happens in this case ?

    What is the return of CLSIDFromProgID ?

    regards

      Hendrik Schmieder

    Tuesday, March 26, 2019 10:33 AM
  • Version: Excel 2016 MSO (I presume MSO means Microsoft Office). 32 bit.

    HRESULT Return value is 0x800401F3 and apparently means an invalid string. My program is 32 bit (for reasons beyond my control) but I run on 64 bit.


    http://www.ransen.com Cad and Graphics software

    Tuesday, March 26, 2019 5:41 PM
  • Hello,

    since your Excel is 32bit your program must also be 32bit.

    I don't have the source code of CLSIDFromProgID,

    but I guess the functions looks for the CLSID in the registry.

    In my registry I see it in

    HKEY_CLASSES_ROOT\Excel.Application.

    Maybe you don't have the required access rights.

    Use process monitor from sysinternals and look at the lines with registry access.

    regards

        Hendrik Schmieder

    Wednesday, March 27, 2019 10:50 AM
  • Hello,

    >> since your Excel is 32bit your program must also be 32bit.

    My OS is 64 bit, but the program accessing Excel at 32 bit is also 32 bit.


    http://www.ransen.com Cad and Graphics software

    Thursday, March 28, 2019 7:01 AM
  • Well, solved. I copied two Excel branches from HKCR\Excel.Application and HKCR\Excel.Application.16 from the Win 10 computer which worked to the one which didn't. Now my program accesses Excel as it should. What happened I have no idea.


    http://www.ransen.com Cad and Graphics software

    • Marked as answer by Owen Ransen Thursday, March 28, 2019 7:04 AM
    Thursday, March 28, 2019 7:04 AM
  • Hello,

    you should have tried  Office rpair before copying registry branches.

    Thursday, March 28, 2019 10:28 AM
  • "you should have tried  Office rpair before copying registry branches."

    Have you tried searching for Office Repair in Cortana? It's pretty hopeless.

    No, the registry way was more immediate, and it worked.


    http://www.ransen.com Cad and Graphics software

    Thursday, March 28, 2019 11:44 AM
  • You are kidding me.

    Office Repair is really simple.

    Open settings-> apps & feature

    select office

    press on change button.

    Thursday, March 28, 2019 12:52 PM
  • You are kidding me.

    Office Repair is really simple.

    Open settings-> apps & feature

    select office

    press on change button.

    So where in that sequence is the word "REPAIR"? I would have thought that the brilliant Cortana would have helped me.

    Note that most peope do not install and uninstall office more than once every two or three years, so what is obvious to an office expert may not be obvious to "lay people."


    http://www.ransen.com Cad and Graphics software

    Thursday, March 28, 2019 1:51 PM