Excel Document Level Customization - Errors with VBA Interop RRS feed

  • Question

  • I'm following Microsoft articles to build an Excel Document Level Customization


    1. Combining VBA and Document-Level Customizations
    2. How to Expose Code to VBA in a VB Project

    I'm having issues with calling document-level VB.NET code from VBA. I believe the issue is more specific to "ReferenceAssemblyFromVBAProject". 

    When you set EnableVbaCallers = TRUE, VSTO automagically setsReferenceAssemblyFromVBAProject to TRUE, and adds VBA code to workbook (or sheet):

    Property Get CallVSTOAssembly() As TestInterop.Sheet1Set CallVSTOAssembly = GetManagedClass(Me)
    End Property

    On the VSTO side, this code is added to the public class:

    <Microsoft.VisualBasic.ComClassAttribute()> <System.Runtime.InteropServices.ComVisibleAttribute(True)>

    The problem is, when I try to debug or publish I get the following error:

    "Cannot update WIN32 resources in assembly "obj\Debug\xxxx.dll". The system cannot find the file specified

    (Where xxx is my project name).

    If I set setsReferenceAssemblyFromVBAProject = FALSE, the program will launch, but immediately to a VBA error highlighting the CallVSTOAssembly function with the error:

    Compile Error - User defined type not defined.

    So I'm sort of in an error death spiral. I believe if setsReferenceAssemblyFromVBAProject = TRUE, then I wouldn't get the VBA compile error. But, I'm unable to avoid the .DLL error. Can someone help with this? 

    Overall, it seems this approach to customizing is nearly deprecated in favor of Office Apps, but I'd still like to know where I'm going wrong. I'm also using VSTO 2013 and Excel 2013.


    • Edited by AllSyntax Tuesday, January 24, 2017 10:41 PM hyperlinks
    Tuesday, January 24, 2017 10:33 PM

All replies

  • Hi AllSyntax,

    I try to look in to this issue and try to find the solution.

    but did not get anything useful that can help to solve this issue.

    I find one another thread in which other community member was faced a similar issue like yours.


    but there also no any useful information available.

    so this issue is little complex.

    I try to involve some senior engineers to look in to this issue.

    generally it will take some more time to get response from senior engineers.

    so till they provide any suggestion to solve the issue.

    please have some patients.

    thanks for your understanding.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, January 25, 2017 5:59 AM
  • Let me know what you find.

    Monday, January 30, 2017 2:20 PM