We help IT Professionals succeed at work.
Get Started

Vb.net word bookmarks

835 Views
Last Modified: 2016-02-11
Hi,

I've added many bookmarks in a word document, which I'm using as placeholders for text data that will be sent from my vb.net app.

From my app, when I click report, the following takes places:

        Dim appWord As New Word.Application
        Dim docWord As New Word.Document

        docWord = appWord.Documents.Add("s:\canevasSoumission.docx")
        appWord.Visible = True

            docWord.Bookmarks.Item("aFraisForNombre").Range.Text = GetStringFromObject(soumissionBindingSourceA1.Item(soumissionBindingSourceA1.Position)("aFraisForNombre"))
            docWord.Bookmarks.Item("aFraisForTarif").Range.Text = FormatCurrency(GetStringFromObject(soumissionBindingSourceA1.Item(soumissionBindingSourceA1.Position)("aFraisForTarif")))
            docWord.Bookmarks.Item("aFraisForCoutant").Range.Text = FormatCurrency(GetStringFromObject(soumissionBindingSourceA1.Item(soumissionBindingSourceA1.Position)("aFraisForCoutant")))
            docWord.Bookmarks.Item("aFraisForVendant").Range.Text = FormatCurrency(GetStringFromObject(soumissionBindingSourceA1.Item(soumissionBindingSourceA1.Position)("aFraisForVendant")))

Open in new window


Once the word document opens up, I can see each bookmark being replaced with the text from my VB app, the thing is the progression is slow, being that I have hundreds of bookmarks, it can take quite some time for the word document to be filled.

I have another app which I've used with the same programming concept, when the word document is being generated the bookmarks get replaced at lightning speed...

I'm wondering if I've done something wrong with the code as to why it's slow...

thanks for the help
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE