Autotext entries as bookmarks??

I

Ivan Debono

Hi all,

I'm using VB6 to automate MSWord to create a document from a template that I
define. The template has Autotext entries, bookmarks and styles.

I'd like to achieve the following though code:

1. Get hold of an autotext entry from the template, fill it as necessary
with records from a database, set styles etc.
2. Keep this autotext entry in memory (not placing it in the document)
3. Get other autotext entries, or whatever
4. Place the autotext enty from memory into a bookmark.

Is this possible? Issue 1 is not problem. I still thinking how to approach
issue 2 though. Any ideas?

Thanks,
Ivan
 
W

Word Heretic

G'day "Ivan Debono" <[email protected]>,

What effect are you trying to achieve? Your stated method is quite
unclear and 'useless'.


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Ivan Debono reckoned:
 
I

Ivan Debono

Currently I have a situation where I can do something like the following:

Name Surname
Address

Date

Item1 Description1 Qty1
Item2 Description2 Qty2

etc...

The first section is the header autotext and below is the details autotext.
Each autotext has its bookmarks. In my code I insert the first autotext,
replace its bookmarks with data. The loop through the details recordset,
insert the second autotext and replace bookmarks. Note that the data comes
from 2 different tabless

This works fine if everything is under each other. Now I want something
different and this time I need data that comes from 5 or 6 different tables.
To keep it simple, I need a template like the following (just an example):

Name Surname Item1 Description1 Qty1
Address Item2 Description2 Qty2
Item3 Description3 Qty3
Date

Notes1
Notes2
Notes3

etc...

This cant be achieved with my current method, so I was thinking of an
alternative method:

1. Design the template exactly as I want it to look like and store it
completely as an autotext and call it Main.
2. Individual fields will be Main's bookmarks.
3. The Items section will also be stored as an autotext and called Items.
4. Items fields will be Items' bookmarks (maybe with Item prefix, eg,
ItemName, ItemDescription, etc)
5. Do 3 and 4 for the Notes section.
6. Furthermore, add 2 bookmarks for Main and call them ItemDetails and
NotesDetails for example.

What's the reason? Well, then I can do something like this in my code:

1. Insert Main autotext
2. Replace Main's bookmarks with fields
3. At the end of the document (or preferably somewhere else), insert Items
autotext and replace bookmarks accordingly.
4. Cut from the beginning of the Items text to the end.
5. Place the text in Main's ItemDetails boomark.
6. Do the same for Notes and NotesDetails.

That's what I'm trying to achieve. I hope it's clear!!

What I still didn't figure out 100% is points 3,4,5 above.

Any suggestions?

Ivan
 
D

Doug Robbins - Word MVP

Assuming that the 5 or 6 tables are in a database, I would suggest that you
use an Access report to achieve what you are after.

Alternatively, see the "Multiple items per condition" item under the
"Special merges" section of fellow MVP CIndy Meister's website at

http://homepage.swissonline.ch/cindymeister/MergFram.htm


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
I

Ivan Debono

They are actually in an Access database and an access report will simplify
things. But I can only distribute the database and ADO and not the Access
engine, so the enduser can design his own reports.

My only alternative would be Word

Ivan
 

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