Link to home
Create AccountLog in
Avatar of PortletPaul
PortletPaulFlag for Australia

asked on

Mail Merge Generated Document - How to keep field in a paragraph

Hi.

Pursuing an idea to generate some documentation via a workbook and have hit a small curiosity I don't know how to fix.

In the Word document (merge template) I have a paragraph under a table that is designed to be Table 1 ... then (automatically) Table 2 ... under the next table and so on.

If I copy/paste the template table & paragraph it works fine.

However, as soon as I generate a new document from the template that field in the generated paragraphs reverts to plain text and I've lost the ability for it to auto-number itself.

What do I need to do to retain this auto-numbering capability.

sample workbook (with macro/template) attached (.xslm)

follows on from:
https://www.experts-exchange.com/questions/28127039/Drive-Mail-Merge-from-excel-Macros-using-Embedded-Docx-Templates.html

Word & Excel 2010:
Make-Docs-From-Embedded-Template.xlsm
Q-28128386.png
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of PortletPaul

ASKER

right, I don't consider mail merge to be the end of the chain here, just part of the equation

so, either I emulate mail merge to build multiple tables in a loop... yuk

or 'post process', so the desire now is, what macro magic would match the style of these paragraphs and re-insert the 'field' for auto numbering behaviour?

a sample would probably be sufficient - I can fix the details
maybe I need to rethink my attitude to using Mail Merge?

any recommended sample macros that would repeat a (table+paragraph) structure to a new document?

I do have another need to reproduce rows of a table that Mail Merge does not do very well (it wants to repeat the table headings).

mmmm
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
rudimentary I know, but the broader picture was hinted at in the earlier question...

The overall objective is to help drive accurate documentation that evolves over time with numerous cross-references, from requirements to test plans and operational instructions

This is performed by a broad geographic spread of individuals (and translations are required)

The concept (and that's all it is right now) is to maintain all (or most) of the cross-referencing material in a workbook instead of Word docs - then derive parts of the needed Word docs when it is logical to do so. Ideally there would be some more robust toolset to undertake this - but there isn't - so it's the ubiquitous Excel/Word I'm resorting to.

The starting point is that I do not want to commence or control this from Word - it must be controlled from the Workbook - and Word elements generated from it.

nb: Not whole (final) documents are intended from the Workbook - just the numerous tables (with cross-references) that can be merged (manually) into the manually prepared deliverable documents.

appreciate any guidance really - right now this is conceptual - I want to build enough to be a 'proof of concept' really. samples and/or good references are always welcomed - I'm not expecting vba scripts of several 1000 lines :) - well not on the basis of one question anyway.

Not sure if this helps at all.

back to a question - where would the 'Quick Parts' be stored? and how are they referenced? (looks like I get to name them). Would these (or could these) be stored in a single embedded word doc?



ps: it's been many many years since I delved into VBA, but I'm not afraid of it, and once I get into the swing of it could be considered better than beginner (well I hope so).
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I did include Word as a topic - didn't I?

Notwithstanding:
>> I will stress - the control of execution MUST be from Excel, NOT Word... on this I will not bend.

My additional desire is to embed any Word files(s) required into the Workbook so that versioning and distribution are simplified
e.g. v1 workbook has v1 embedded document and can survive on its own merits after v1.1 is issued and so on.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
thanks for the tip on 'QuickParts' to be frank that entire piece of Word had escaped my attention. This proved to be an amazing reference on that topic:
http://gregmaxey.mvps.org/word_tip_pages/building_blocks_autotext.html

But, I now have  another concern. If QuickParts are stored in the Normal.dot or Building Blocks.dotx than these could be really troublesome for my intended purpose (broad distribution without complex dependencies).

Additionally, while that URL above provided some VBA related to QuickParts, I still haven't seen one which:
a. chooses a quickpart, and
b. uses that quickpart like a mail merge template (i.e. repeats the quickpart filled-in with data from Excel)

Do you really believe defining quickparts can work via an embedded document in Excel
(and used by someone half-way around the world)?
I'm not at all sure if quickparts will survive within a document embedded into Excel, but at least i now know something about their existence  thanks for that.

Thanks for the various pointers. I will still be working on this concept on  off for a while I think and will probably be back for more questions.

Cheers,
Paul
Thanks & good luck