none
Error: Programmatic access to Visual Basic Project is not trusted RRS feed

  • Question

  • I have written code in ASP.NET MVC using C# to create an Excel spreadsheet.  It works on my local development machine, but it doesn't work on the production server.  I found this Microsoft KB article about the error:

    http://support.microsoft.com/kb/282830

    It says I need to open Excel and check the "Trust access to the VBA project object model" check box.  I did that on both my local machine and on the server running the production website, but I am still getting that trust error on the production server.

    Does anyone know the solution?  The production server is running Excel 2013 on Windows Server 2008.


    MCSD .NET developer in Dallas, Texas

    Wednesday, January 7, 2015 4:00 PM

Answers

  • Hi DallasSteve,

    Thanks for posting in MSDN forum.

    Based on the description, you wre programmatically manipulating the Microsoft Visual Basic for Applications (VBA)   environment via automating Office application.

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    You can get more detail from link below:
    Considerations for server-side Automation of Office

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 8, 2015 2:41 AM
    Moderator

All replies

  • Hi DallasSteve,

    Thanks for posting in MSDN forum.

    Based on the description, you wre programmatically manipulating the Microsoft Visual Basic for Applications (VBA)   environment via automating Office application.

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    You can get more detail from link below:
    Considerations for server-side Automation of Office

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 8, 2015 2:41 AM
    Moderator
  • Fei

    I think you have identified the problem.  We have a web page that displays data the user can enter.  We want to give the user the option to download that data into an Excel spreadsheet and do their data entry offline, then upload the spreadsheet data back into the database through the website.  As I say it all works from my local machine, but not when we deploy to the production server.

    The link you provided seems to promote Open XML as the alternative.  Do you think that is the best solution for the process we are trying to develop?

    Thanks a lot.

    Steve


    MCSD .NET developer in Dallas, Texas

    Thursday, January 8, 2015 3:00 PM
  • As the error description says it looks like you are attempting to access the VB object model in the user's instance of Excel, reading or writing to the file's VB project perhaps. I have no idea what you are doing but I doubt XML would help you with that.

    Are you sure you need to do access the project? If not sure check what in particular is raising the error, in your development system disable "trust access..." and test. 

    Thursday, January 8, 2015 4:39 PM
    Moderator
  • Hi DallasSteve,

    >>The link you provided seems to promote Open XML as the alternative.  Do you think that is the best solution for the process we are trying to develop?<<

    Based on my understanding, it is a alternative way for the server-side automation. Also you may inserted in the links below:
    [MS-OVBA]: Office VBA File Format Structure

    How to: Manipulate Office Open XML Formats Documents

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 20, 2015 8:04 AM
    Moderator
  • I've been working with Open XML for about 1 week and it is absolutely horrible.  Nobody could possibly understand all of this.  The structure of the package is poorly thought out and the documentation is abysmal.  It's a hodge-podge mess and it's just copy and paste and hope for the best.  I've been able to get basic spreadsheets to work, but nothing advanced.

    MCSD .NET developer in Dallas, Texas

    Tuesday, January 20, 2015 3:40 PM
  • Hi Dallas,

    Thanks for the feedback about document of Open XML.

    If you have issue about Open XML developing, I suggest that you reopen a new thread in Open XML SDK forum to get more effective response.

    Also here are some useful links for you learning Open XML developing:

    Working with SpreadsheetML documents (Open XML SDK)

    Spreadsheets (Open XML SDK)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 21, 2015 2:52 AM
    Moderator