none
Error when building an office customizatioin RRS feed

  • Question

  • Hi

    I do not succeed in developing an office (Word 2010) customization that calls code from VBA, with Visual Studio 2012. I executed walk through "Calling Code from VBA in a Visual Basic Project" but I consistently get the error "Cannot update WIN32 resources in assembly "obj\Debug\<name>.dll". The system cannot find the file specified."

    Trust center settings are set correctly.

    Thanks for providing help

    Wednesday, April 17, 2013 7:00 PM

All replies

  • You download the below sample and run the sample on your machine. If the sample can run on your machine, You can check your custom project according to the sample, if the sample don't run, you can try to fix the error and you also can show the error message by using Screenshot or Error Message.

    VSTO Interop with Excel VBA macros 

     

    If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer. my sample

    Thursday, April 18, 2013 2:52 AM
  • Thanks for your suggestion. However in the meantime I could narrow down the problem a little bit.

    The walkthrough I referenced earlier : http://msdn.microsoft.com/en-us/library/vstudio/bb608609(v=vs.100).aspx

    In this (short) walkthrough, under "exposing the method to VBA code", property "enableVBAcallers" of document 'thisDocument.vb' must be set to true (see picture).

    This automatically sets property 'referenceAssemblyFromVBAproject' to true as well.

    If you then build or debug (with this property set to true), the error occurs (see picture below).

    If you set property 'referenceAssemblyFromVBAproject' ' to false again, building produces no errors. Debugging opens the Word document (as indicated in the walkthrough) but this word document now contains a piece of auto inserted code that produces Word compiler error "user-defined type not defined".

    Would appreciate some more help. Thanks

    Sunday, April 21, 2013 6:33 PM
  • Hi Herwig9820,

    Thank you for posting in the MSDN Forum.

    I can reproduce your scenario on my VS2012 + Office 2013 machine.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 22, 2013 8:09 AM
    Moderator
  • Hello Quist Zhang

    Thank you very much. For your info, I tried this on VS2012 (update 2) + Office 2010 and on VS2012 (update 2) + Office 2013 machines.

    Best regards

    Herwig

    Monday, April 22, 2013 8:22 AM
  • Hi Herwig,

    I was having the same issue FOREVER.  Since I couldn't find anything else online, I decided to make an account just to share my solution with you so it's SOMEWHERE online.  I FINALLY (seriously, this took me forever) figured it out:

    Do NOT follow the tutorial online.  You don't need to enable vba callers (but you already knew that, since doing this breaks the entire build process).

    Simply use the following code in VB.net (I put mine in the ThisWorkbook_Startup event):

    Dim xlapp As Excel.Application

    xlapp = ThisApplication

    xlapp.Run("SayHello")


    That worked for me.

    The only caveat/warning that I want to mention is that my Excel sheet includes the following VBA code:

    sub SayHello()

    msgbox "Hello"

    end sub

    It ALSO includes the following code in the ThisWorkbook module (in VBA):

    Property Get CallVSTOAssembly() As NameOfVBProject.ThisWorkbook
        Set CallVSTOAssembly = GetManagedClass(Me)
    End Property

    Hope that helps!


    • Edited by gtrow Friday, April 26, 2013 9:29 AM
    • Proposed as answer by gtrow Friday, April 26, 2013 8:13 PM
    • Unproposed as answer by Herwig9820 Saturday, April 27, 2013 7:39 AM
    Friday, April 26, 2013 9:29 AM
  • Hi gtrow

    Although your example works, unfortunately it is not yet the answer to my problem. What I need is to call into visual studio code FROM VBA (and not the other way around). So, the actual method that needs to be called, does not reside in the Excel application, but in the code built by Visual Studio. And this does not work.

    Best regards

    Herwig

    Saturday, April 27, 2013 7:45 AM
  • Hello Herwig9820,

    Please refer to the article http://support.microsoft.com/kb/317535 which talks about "How to Call a Visual Basic .NET Class Library from Visual Basic for Applications in Microsoft Office".

    Also, the article http://support.microsoft.com/kb/956933?wa=wsignin1.0 should be helpful when building a project with "Register for COM interop" for a 64-bit assembly.

    Hope that helps.

    -Pradip

    Friday, May 17, 2013 12:25 AM
  • Was this ever resolved? I have the same issue. I'm using Excel 2013, VSTO 2013.

    It seems simply enabling the "EnableVbaCallers" on a sheet (which also enables ReferenceAssemblyFromVbaProject) causes the problem. 

    Monday, January 23, 2017 7:30 PM