Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cannot build XLLs using Visual C++ .NET (Excel 2000 SR1 & Excel 97 SR2)

    Dear Lounge,

    I am having problems producing fully recognisable xll files for Excel using Visual C++ .NET and
    really do need a little advice of an Excel SDK expert. I'm just a beginner, so please bear with me.

    I write software as a hobby and have a number of C functions I would like to use with Microsoft
    Excel by incorporating them into an xll, using the Excel '97 SDK and Visual C++ .NET. To get
    started producing xlls it seemed like a good idea to build the Excel SDK Frmwrk32 example
    project with VC++ .NET without changes, and take it from there. I obtained the Frmwrk32 example
    by following the advice contained in Microsoft Knowledge Base Article Q152152.

    I unzipped all files from the Frmwrk32.exe file (see Q152152) and placed them in their own
    separate directory. I started Visual Studio .NET and opened generic.mak. VC++ offered to
    convert to VC++ 7.0 format. I clicked yes to convert (clicking no results in VC++ .NET failing
    to open the generic.mak file). The project seemed to convert successfully.

    I made sure that the Configuration Manager was set to Release Build as advised in Knowledge Base
    Article Q194926 and rebuilt the project. This created a fresh version of generic.xll in the
    project directory without any renaming (from dll to xll) required.

    I tried to open the new generic.xll in Excel 2000 under Windows XP Pro. Excel reported the file
    as containing macros, so it recognised the file to an extent, but after I clicked to Enable
    Macros the next message was that 'This file is not in a recognisable format' (?). I get the
    same result trying to open the recompiled generic.xll in Excel '97 under Windows '95 on the
    computer I use at work.

    The original unzipped generic.xll works fine on both machines. The original was built by
    someone at Microsoft in 1997 using a previous version of VC++; I can't find reference to the
    exact version used.

    Presumably if the code was built sucessfully in 1997 then it should be possible to sucessfully
    built it again without any changes in VC++ .Net in 2002 ?! Do you have any suggestions on how I
    can get started generating xlls that can be properly recognised using Visual C++ .NET?

    Regards,

    Stuart Cowling.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Cannot build XLLs using Visual C++ .NET (Excel 2000 SR1 & Excel 97 SR2

    Hi Stuart,
    I can only think of 2 things here. First is to double check that your xll is definitely a release build and not a debug build (I guess you've probably already done that!) The other thing is that I don't know if VC++7 has any changes in it that would prevent it working with earlier versions of Excel - I can't find anything in the MSKB that says you can't use it but I also can't find anything that says you can. I have a beta copy of Visual Studio .Net at home that I haven't had a chance to try out yet, so if I get a chance I'll see if I can follow your steps and get it to work - I'll be testing it on WinXP Pro and Excel2k too.
    Hope that helps.

    [Edited to add afterthought]
    Do you get the same error if you try to load it via Tools-Add-Ins just as a matter of interest?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot build XLLs using Visual C++ .NET (Excel 2000 SR1 & Excel 97 SR2

    Rory,

    Thanks for the reply.

    I made sure that VC++ was set for release build and tried again as you suggested but I got the same result. I also tried opening the xll using Tools-Add-Ins and received the error "'generic.xll' is not a valid add-in".

    I don't know much about changes to VC++, I couldn't find any mention of anything similar in the MSKB apart from the release/debug issue we have mentioned.

    Regards,

    Stuart Cowling.

  4. #4
    New Lounger
    Join Date
    Mar 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot build XLLs using Visual C++ .NET (Excel 2000 SR1 & Excel 97 SR2

    Rory,

    After speaking at length to a very helpful guy at Microsoft UK Technical Support I can offer this method of getting VC++ to generate 'recognisable' xlls.

    For a recognisable debug build:

    1) Set Project Properties > C++ > Debug Information Format = C7 Compatible

    2) Rebuild

    For a recognisable release build also do the following:

    3) Change the Configuration Manager settings to release build.

    4) Set Project Properties > C++ > Code Generation > Enable String Pooling = No

    5) Set Project Properties > C++ > Code Generation > Enable Function Level Linking = No

    6) Set Project Properties > C++ > Optimization = Disabled

    7) Rebuild

    From this point forward is is possible to switch from Debug to Release at will and C++ .NET will rebuild recognisable xlls.

    I can't comment any further than this because I'm not an expert. But the above worked for me. It's a pity that code optimisation has to be disabled. If anyone out there can add to this please go for it.

    Regards,

    Stuart Cowling

Posting Permissions

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