locked
Not able to open word programatically due to permissions issues(maybe) RRS feed

  • Question

  • User-552339817 posted

    Team,

    Working on a web app installed on 64 bit Windows 2008 OS and using 64 bit office 2010.

    I have tried hard to find a fix for this. I am not able to open a word file programatically . I get this error as per stack trace

    System.Runtime.InteropServices.COMException (0x800A175D): Could not open macro storage.

       at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)

       at Edenbrook.Hindsite.BL.DocumentHelpers.Word.WordDoc.Open(String strFileName).......

     

    This basically opens up a template with dot extension . I have given appropriate permissions to the file/folder containing the file. with network service and also a service account user.

    I have also followed up with a link      http://support.microsoft.com/kb/224338                        which gave me  a solution as

    To avoid the error, do one of the following:
    Start Word as the Interactive User.
    Start Word as a user with administrator rights.
    Load the user hive for the user account programmatically, or have a dummy service that runs under the user account.
    You must identify under what user account Word is running, and in what context you are developing. For example, if you are automating from a Microsoft Transaction Server (MTS) package, the default user account is IWAM_MachineName.

    Now the thing is i have a user which i have impersonated but as per rule of the company he cannot be an administrator user of the server. Is there any alternative to this ?

    Any alternatives to workaround this problem ?

     

     

    Wednesday, October 1, 2014 6:50 AM

All replies

  • User-760709272 posted

    You've already been told what you're doing isn't supported, Microsoft have never said that automating Word from asp.net will work, in fact the actively say it probably won't work.  Even if you do manage to get your code working, I guarantee it will regularly fail, you'll end up with orphaned instances of Word hanging around and eventually your code will just stop creating instances of Word altogether.  Take it from us who have been there and done it already.  The solution is that you need to use something intended to be used from asp.net.  Your options are Open XML SDK, or a third party component like Aspose.  Aspose isn't free, but if you can afford a license to install Word on a web server such that it can be used by 1,000,000+ people, I'm sure you can afford Aspose :)

    I appreciate this isn't the answer you are looking for, but no matter how many times you ask the answer will remain the same.

    Wednesday, October 1, 2014 7:03 AM
  • User-552339817 posted

    Hi Aidy,

    I get you . But by using OpenXml can you confirm that i won't be facing such issues ? There;s very little time for Development now. I am using the old Microsoft.Interop.Excel classes. I am not through with Open XML claases yet.  How easy it is to implement or map the existing Interop methods. ?

    Wednesday, October 1, 2014 7:30 AM
  • User-1818759697 posted

    Hi,

    For this error message, "System.Runtime.InteropServices.COMException (0x800A175D): Could not open macro storage", you could refer to:

    http://forums.asp.net/t/1378387.aspx?System+Runtime+InteropServices+COMException+Could+not+open+macro+storage

    http://support.microsoft.com/kb/973746/en-us

    Regards

    Thursday, October 2, 2014 1:14 AM
  • User-552339817 posted

    Tried them both already. No respite.

    Sunday, October 5, 2014 12:15 AM