Syntax Error in generated Excel.idl file.

Aleks 25 Reputation points
2025-06-01T20:28:14.12+00:00

Hello everyone,

I extract type library info from EXCEL.EXE. I need a header file to access enabled excel objects.

The tool is oleview.exe. The generated file is EXCEL.IDL.

During compilation midl.exe report an error:

.\excel.idl(786) : error MIDL2025 : syntax error : expecting a type specification near "single"

.\excel.idl(786) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation

How to solve the error problem?

Best Regards

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,366 questions
0 comments No comments
{count} vote

Accepted answer
  1. Austin-H 2,775 Reputation points Microsoft External Staff Moderator
    2025-06-02T01:52:21.74+00:00

    Hi Aleks ,

    Good day! Welcome to Q&A forum. 

    I understand you're working on creating an excel.idl file with oleview.exe so you can access enabled Excel objects. However, single is considered an invalid data type within the MIDL language, and this is what forces the compiler to stop its process. I've run a test to recreate a similar error scenario and edited this .IDL file by replacing all instances of "single with "float". Please give this change a try and see how it works for you: 

    1. Open a text/code editor you're familiar with (like Notepad, Notepad++, Visual Studio Code, etc.). 
    2. Open the EXCEL.IDL file: Go to File > Open > EXCEL.IDL (this is the file generated by oleview.exe when viewing EXCEL.EXE). 
    3. Find all instances of the word single and replace them with float: Use the Find and Replace feature (single => float). 
    4. Save the file. 
    5. Re-run the midl.exe command to compile. 

    If you've already applied this change but are still encountering issues or if a different error has come up, would you be able to provide a screenshot of the error message you're currently seeing?  I'll do my best to assist you as quickly as possible 

     


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".    

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Aleks 25 Reputation points
    2025-06-02T15:13:11.6233333+00:00

    Yes, I applied changes. Here they are command line and next reported errors:

    midl.exe excel.idUser's image

    Then I insert /mktyplib203 key:

    midl.exe /mktyplib203 excel.idUser's image

    Two steps forward.


  2. Aleks 25 Reputation points
    2025-06-03T14:15:41.54+00:00

    Hi Jack,

    I confirm 'float' data type replace 'single' successfully.

    My goal is Excel (Automation) Objects. I have to #include a header file, where the Excel data structures(objects, interfaces) are declared. Let`s take Application(as above) interface and follow my steps

    1. Open Regedit.exe->Excel.Application Registry Key->CLSID->LocalServer32-> ...\EXCEL.EXE /Automation
    2. Open oleview.exe->View Typelib->Open EXCEL.EXE
    3. Auto open ITypeLib Viever->Save As EXCEL.IDL (*.h and *.c options failed)
    4. Command Line: midl.exe EXCEL.IDL
    5. midl compilation failed!

    So, I do not program an IDL/ODL interface(I can not), just compile system generated EXCEL.IDL. What expecting is *.h file in C/C++ style.

    If there is a shortcut to *.h, let me known. Otherwise I am ready to see it through to the end.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.