Help needed for time saving!

  • Thread starter Jens 'Kluesi' Kluesener
  • Start date
J

Jens 'Kluesi' Kluesener

Hi

I have got created an Excel Script that creates a Word Document. A bill.
But for only 8 bill entries the script needs to much time. For this entries
it works about 30 secounds. If you want to help me look at this page:

www.kluesener.info/excel.html

And if you find anything that saves time please tell me how I can do it
better.

Sorry for my bad english

Many Thanks

Jens
 
A

Astrid

Hi Jens,

If I look at your code I see that you type all the text from within the code. Why not setup a template that contains the fixed texts and use bookmarks as placeholders. Those bookmarks can be used in VBA to set your variable text.
First create a new template, put all the fixed text in it, place bookmarks for variable texts (Insert - Bookmark) and format it the way you want it.

Now use this template as a base and start a new document from your Excel project based on it:

Dim oDoc as Document
Set oDoc = appWord.Documents.Add(Template:="Path and filename here")
oDoc.Bookmarks("NameOfBoomark").Range.Text = "Variable text"

etc

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top