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 7572645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:58:37+00:00 2026-05-30T15:58:37+00:00

Let me first describe the problem. I have this application that opens a word

  • 0

Let me first describe the problem. I have this application that opens a word document and updates all the fields and then saves the document in another folder. The word document is just used as a template for a report. It is filled with linked content from an excel worksheet. The whole application works, but the problem is that the excel document is password protected. when I update the document fields the application is stopped and word asks for a password.

When you input the password, the program works as advertised, you have to insert it more than once thou, dont really know why. But the program is suppose to work autonomously without user input. Is there a way to give word the password so that it doesnt have to be entered, either via code or in the word document properties.

Below is my current code that does this, its in C#

    Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application();
        Document doc = ap.Documents.Open(template, ReadOnly: false, Visible: false);
        doc.Activate();
        red_debug.AppendText("opening " + template + "\n");
        doc.Fields.UpdateSource();
        doc.Fields.Update();
        red_debug.AppendText("Saving as " + final + "\n");
        doc.SaveAs(final, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument);
        doc.SaveAs(path + "\\" + name, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF);
        red_debug.AppendText("Closing word" + "\n");
        doc.Close();
        ap.Quit();
  • 1 1 Answer
  • 1 View
  • 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-30T15:58:39+00:00Added an answer on May 30, 2026 at 3:58 pm

    Get the Word document to open up the Excel file (with the password) for you everytime it has been opened. Same time, we can also successfully close the Excel file from Word.

    Put this into the Word macro area.

    Private Sub Document_Open()
    
    Dim xlApp As Object
    Dim xlWB As Object
    Dim myRange
    
    Application.DisplayAlerts = wdAlertsNone
    
    Set xlApp = CreateObject("Excel.Application")
    Set xlWB = xlApp.Workbooks.Open("C:\ExcelFile.xls", , , , "password", "password")
    Set myRange = Selection.Range
    
        Selection.WholeStory
        Selection.Fields.Update
        myRange.Select
    
    xlApp.Quit
    Set xlWB = Nothing
    Set xlApp = Nothing
    
    Application.DisplayAlerts = wdAlertsAll
    
    End Sub
    

    This will open up the excel document and update ALL fields on your word document and shouldnt ask you for password

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

Sidebar

Related Questions

Let me describe my problem first. I have a class which holds a NSMutableDictionary
I've got a strange problem. Let me first describe my situation: Webserver01 (Webapplication, SQL,
Let me first describe my goal: I have created an object with 3 properties:
First let me say that I really feel directionless on this question. I am
First let me say I have read this useful article thoroughly and am using
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
Please help me to resolve the following problem: First of all, I have one
First off, I don't know if this is possible, but let me describe my
I will first describe the problem and then what I currently look at, in
To describe my dilemma, let me first start with an example problem (stolen from

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.