none
Exception in Windows Services RRS feed

  • Question

  • Hi

    I'm using Marshal.GetActiveObject to get all the running instance of MS Word, it work fines in window forms but when i use this in Windows Services it gives exception 'Operation unavailable at System.Runtime.InteropServices.Marshal.GetActiveObject'

    wapp = System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application")

    I want to get all the running instance of MS Word, anyone got any ideas how i can achieve this.

    thanks ..


    Friday, March 1, 2013 6:16 AM

Answers

  • Hi NA_01,

    This feature is not supported: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757 

    Developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service.

    This article discusses the complications that developers may face. The article also offers alternatives to Automation that can speed performance. Developers should be aware, however, that the suggestions that this article provides are for informational purposes only. Microsoft does not recommend or support server-side Automation of Office.

    Best regards,


    Mike Feng
    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.

    • Marked as answer by Wall.E Thursday, March 7, 2013 12:01 PM
    Monday, March 4, 2013 3:23 PM
    Moderator

All replies

  • I want to get all the running instance of MS Word, anyone got any ideas how i can achieve this.

    thanks ..

    http://stackoverflow.com/questions/11986636/get-a-collection-of-all-open-word-applications


    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Friday, March 1, 2013 10:42 AM
  • Hi,

    your supposed answer usually works fine in 'Window Form' application but I'm trying to do this in 'Windows Service' and that's where i got problem ..

    thanks.

    Friday, March 1, 2013 12:49 PM
  • Hi NA_01,

    This feature is not supported: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757 

    Developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service.

    This article discusses the complications that developers may face. The article also offers alternatives to Automation that can speed performance. Developers should be aware, however, that the suggestions that this article provides are for informational purposes only. Microsoft does not recommend or support server-side Automation of Office.

    Best regards,


    Mike Feng
    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.

    • Marked as answer by Wall.E Thursday, March 7, 2013 12:01 PM
    Monday, March 4, 2013 3:23 PM
    Moderator
  • thanks Mike, my confusion is solved.
    Tuesday, March 5, 2013 7:41 AM