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

  • Home
  • SEARCH
  • 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 8876779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:17:47+00:00 2026-06-14T19:17:47+00:00

I create word documents via automation and mailmerge with office Interop from c# (.net4).

  • 0

I create word documents via automation and mailmerge with office Interop from c# (.net4). The merge works well and the user receives the created document as he desires. So far all is well.
The client now requests, that if he tries to save the generated file (via save file dialog), that the filename of the document is already prefilled.

I already have tried the obvious things such as setting the Name property of the Document-instance and other properties, I also googled for a solution but up to now, I was not able to set the file-name of the word file (without saving it).

Does someone knows a way how to achieve this? I feel that the client would be very happy if it would work, and I also spent already a lot of time on this (I have to admit that word automation is a thing I have not a lot of experience).

  • 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-06-14T19:17:48+00:00Added an answer on June 14, 2026 at 7:17 pm

    If you set the Title property of the document, when you choose Save As, that is the document name that will be used. You can also set the default save location. In VBA

    Set doc = ActiveDocument
    
    sTitle = doc.BuiltInDocumentProperties("Title").Value
    doc.BuiltInDocumentProperties("Title").Value = "A different title"
    

    However, this only works on the second (and later) save attempt(s). The first attempt will always use the title from the template, if any, or content from the first line of the document if none. See the end of this answer for a better solution.

    Note, however, that you must make some change to the document before Save As for the new title to take effect.

    Sub SetSummaryInfo()
    Dim dp As Object
    Dim sTitle As String
        If Documents.Count > 0 Then
           Set dp = Dialogs(wdDialogFileSummaryInfo)
           ' Retrieve value of "Title" into a variable.
           sTitle = dp.Title
           ' Set "Title" to a new value.
           dp.Title = "My Title"
           ' Set the value without showing the dialog.
           dp.Execute
           ' Save the changes
           'ActiveDocument.Save
        End If
    End Sub
    

    As remarked by HCL in C#, you can set the default filename (for the dialog only) using this code:

    dynamic dialog = wordApp.Dialogs[WdWordDialog.wdDialogFileSummaryInfo]; 
    dialog.Title = "MyTitle"; 
    dialog.Execute();
    

    This opens the standard “Save As” dialog, sets the default filename (not what you’d expect from a ‘Title’ property but that’s what it does), and opens the dialog.

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

Sidebar

Related Questions

Is it possible to automatically create Word documents which include list fields from a
I have some C# automation code which does interesting things with Microsoft.Office.Interop.Word.Document objects. The
I am trying to create word documents using Microsoft office interops. The document should
I'm using MS Office 2003 PIA to create a MS Word document from c#.
I Opened/Created a new Word document dynamically on FormLoad using: using Word = Microsoft.Office.Interop.Word;
I need to create a Word template where I can choose from different paragraphs
I'm looking for some options to programmatically create a Word document from within a
I am trying to create a word document from a java application and am
I am trying to generate word documents using the mail merge feature in Microsoft
I'm using openxml to create Word DOCX files. I'd like to save these documents

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.