Avatar of FCapo
FCapo
 asked on

Vb.net word bookmarks

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
Microsoft WordVisual Basic.NET.NET ProgrammingVBA

Avatar of undefined
Last Comment
DrTribos

8/22/2022 - Mon
AndyAinscow

>>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...


As I don't have the code - then my guess is:  yes, you have done something wrong - just what I haven't a clue.
SOLUTION
Jacques Bourgeois (James Burger)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
DrTribos

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck