Interop.Word error "Could not open macro storage" in published wcf service method
-
Wednesday, March 07, 2012 10:18 AM
Hi,
I've created the WCF service method to create a word document from template URL & published it in IIS 7.
I'm receiving an error "Could not open macro storage" in the below code.
Microsoft.Office.Interop.Word._ApplicationoWord = newMicrosoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word._DocumentoWordDoc = newMicrosoft.Office.Interop.Word.Document();
oWord.Visible = false;
Object oTemplatePath = templatePath;
oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
Please suggest some solutions for my error. Thanks in adv!!
Anandhan.S
- Moved by CoolDadTxMVP Wednesday, March 07, 2012 2:52 PM Office related (From:Visual C# General)
- Edited by Anandhan Sathyanarayanan Tuesday, March 13, 2012 1:57 PM Title change
All Replies
-
Friday, March 09, 2012 6:55 AMModerator
Hi Anandhan.S,
Thanks for posting in the MSDN Forum.
As far as I know, that Office PIA doesn't recommend use on server's environment. http://support.microsoft.com/kb/257757 . A OpenXml SDK will used to create Word document. And as far as I know, there has no good way to add macro to Word document via OpenXml.
And I will involve some experts into this issue to see whether them have good work round of it. There might be some time delay, thanks for your patience.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
-
Friday, March 09, 2012 8:51 PMModerator
Hi Anandhan,
Tom Xu’s response is correct – unattended automation of Office products is not
supported. He referred you to the KB article 257757.Considering the error you receive there is an explanation for it in the following content:
Microsoft Office Development with Visual Studio
http://msdn.microsoft.com/en-us/library/aa188489(v=office.10).aspxWhere you’ll find the following:
When I automate Microsoft Word from ASP, I get an error that states "Could Not
Open Macro Storage."You are running Word under the context of a user that does not have its registry hive
loaded. Word requires that a "user hive" be loaded for it to run
correctly. For more information, please see
PRB: Error 800A175D - Could Not Open Macro Storage (Q224338).Use the ‘Find’ (Ctrl+F) for the string ‘could not open macro storage’
in the article, where you’ll see 3 references to that string.More content includes the following:
Word 2010 Development | References, Code, VBA, PIA, Open XML
| MSDN
http://msdn.microsoft.com/en-us/office/ff972307How to parse VBA code and generate XML file from it [Using C#]?
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ecdf1a59-597c-41b5-806b-6ef126519c8eConverting Word 2010 Documents from the DOCM to DOCX File
Format ...
http://msdn.microsoft.com/en-us/library/gg131933.aspxRegards,
Chris Jensen
Senior Technical Support Lead
Chris Jensen
- Marked As Answer by Anandhan Sathyanarayanan Tuesday, March 13, 2012 1:46 PM
-
Tuesday, March 13, 2012 1:55 PM
Hi,
Thank u all for your response.
I've resolved the error by configuring Windows Authentication in both IIS & WCF configuration.
Component Services(DCOMCNFG) Property: Computers - My Computers - DCOM Config - Microsoft Office Word 97 - 2003 Document Properties - Identity set to Interactive user - Security, Launch & Activation Permissions added (Network Service, IIS_USRS).
IIS Application Pool: Identity - Local System, Managed Pipeline-Integrated
Anandhan.S
- Marked As Answer by Anandhan Sathyanarayanan Tuesday, March 13, 2012 1:55 PM

