Link to home
Get AccessLog in
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
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

>>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
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
ASKER CERTIFIED SOLUTION
Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access