Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 671537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:23:04+00:00 2026-05-14T00:23:04+00:00

I have Microsoft Word template that I automated filling it’s fields from my application,

  • 0

I have Microsoft Word template that I automated filling it’s fields from my application, and when the user requests to print I open this template.

But creating the Word application every time a user requests to print after filling fields is very expensive and can lead to some delay while opening the template. So I choose to cache the reference to Word then just open the new filled template.

That solved the performance issue as opening the file is less expensive than recreating Word each time, but this only works when the user just closes the document not the entire Word application. When this happens my reference to Word becomes invalid and returns with exception: “The RPC server is unavailable” upon the next request of opening the template. I tried to subscribe to the BeforeClosing event but this triggers quitting Word as well as closing documents.

My question is how to know if the Word is closing a document or quitting the entire application so I take the proper action, or any hint for another direction of thinking about improving the performance of opening a Word template.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:23:05+00:00Added an answer on May 14, 2026 at 12:23 am

    I’m unfamiliar with how to properly subscribe to the Word closing events. But it seems like one option you could take is to optimistically assume that Word is not closed and use your caching route. At a high level catch the Exception type thrown when Word is closed. If you encounter this exception, remove your reference to word and repeat the operation like it was happening for the first time.

    You won’t get the caching all of the time this way. But you will be able to take advantage of situations where the user only closes the document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have quite big document in html format that generated from Microsoft Word. It
I have automated word document creation from templates using the Microsoft Word 12.0 Object
I have seen in a few cases that converting a file from Microsoft Word
I have a very simple Office utility question. Open Microsoft word (2003 or 2007),
I'm building some Word 2003 macro that have to be put in the %APPDATA%\Microsoft\Word\Startup
A little back story : I have small application that will use Word to
I have an VB.Net/C# application that programmatically: Creates an RTF document Open it up
Let me first describe the problem. I have this application that opens a word
Presently I am attempting to build a tool that will open a Microsoft Word
I have created a Word template that I am then processing via the OpenXML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.