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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:11:46+00:00 2026-05-21T20:11:46+00:00

I am automating Word from VB.Net. I open a document by: Dim msWord as

  • 0

I am automating Word from VB.Net.

I open a document by:

Dim msWord as Word.Application = CreateObject("Word.Application")
Dim doc As Word.Document = msWord.Documents.Add(Template:=Path)

where path points to a template file I created with a header and a watermark. The template has some bookmarks which I want to dynamically set to some appropriate text values:

doc.Bookmarks("DocumentTitle").Range.Text = "The Joy of Office Automation"

If I comment out that line, the document opens in Word with the watermark, etc, in place. If I let that line execute, it inserts the text as appropriate, but the watermark and other things disappear from the document. You can actually see it flash briefly, and then disappear.

FWIW, this is Office Word 2007, and I am opening a .Dot (Word 97-2003) template. The Bookmark.Range.Text I am setting is in the document header.

Office Automation gurus, what am I doing wrong?

Thanks,
Gerald

  • 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-21T20:11:47+00:00Added an answer on May 21, 2026 at 8:11 pm

    My first thought is maybe somehow you’ve got the watermark associated with the range that the bookmark “marks”. If you then replace that range with some other text, pop! no more watermark.

    But that seems like a longshot because I don’t think watermarks are normally associated with ranges.

    Is it possible the bookmark spans a section break? If the watermark is set to a specific section and replacing the bookmark wipes out the section break, you’ll loose everything about that section (including possibly headers, footers, margins etc).

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

Sidebar

Related Questions

I need a way of generating a word document (from a template or something)
I would like to open a Word document in C#. I mean I would
I am using Word Automation to manipulate some documents (yuk!). I am using this
I have a large collection of MSWord documents (approximately 40,000), which are the results
I'm facing a problem with a MS Word DDE Automation controlled by our CRM
I looking at automating a mailshot process. Currently the mail merge is done in
BACKGROUND I am automating an PowerPoint 2007 via C# I am writing unittests using
Similar questions have been asked, but nothing exactly like mine, so here goes. We
Please Note: Portable as in portableapps.com, not in the traditional sense of a language
Does anyone have any good advice or experience on how to create an engine

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.