macro to select multiple textblocks and insert into word document

V

Vinnie

Hello all,

I have been given the assignment to create a word template with the
possibility
to insert predefined textblocks in this document.

When the user opens the template, it will be already merged with specific
customer data (comming from a third party application).

Now the user must be able to select different text blocks (through a macro),
to insert into the document.
One issue, everything must be in one document, meaning, the macro and the
text to select, must be in the word template.

Does anyone has some pointers to give me. I'm a novice in vba programming.
I was thinking to put all text into a database, but then my question is, how
to access the text blocks and insert them into the word doc ...

All help would be much apreciated.

Vinnie
 
D

Doug Robbins - Word MVP

I would suggest that you consider the use of a userform.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

and the following pages of fellow MVP Greg Maxey's website :

http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm

http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

The text blocks could be saved as autotext entries in the template and you
could have a list of them in one listbox on the userform and have another
listbox with a command button that would allow you to move the selected item
from the one list box to the other in the order that you want the text
blocks to appear in the document.

The possibilities are endless.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
B

billbell52

I just completed something like this for a company. I used an Access
Db, UserForms and simple templates. One UserForm which is a tabbed
panel allows the office manager to predefine all the text in the
different categories - spec, results, customers, contacts,
equipment...etc. All this data goes into the database. There is
another UserForm (again tabbed panel) that allows the technician to
select the info that is in the database. The selection is either via
Comboboxes or Checkboxes. Once selected and a button is clicked it
fills in a template formatted the right way. I use bookmarks to
figure where to place the text. It also creates a pdf and can email
the document. Like Doug said the possibilities are endless.

FYI. I looked at using Oracle and MySQL but Access seems to work
well. Also the AccessDB, UserForms and templates are on a central
server so no need to copy this to every PC. I just put a link in the
STARTUP directory pointing to the central server. This seems to work
well for a smaller company environment.
 
M

Mark Caldwell

Is there a "resource" that can be found online that lists, explains, and
provides examples for all the Macro commands and their syntax for Word 2007?
 
J

Jay Freedman

On Wed, 19 Aug 2009 10:45:01 -0700, Mark Caldwell <Mark
Is there a "resource" that can be found online that lists, explains, and
provides examples for all the Macro commands and their syntax for Word 2007?

The following pages are the "entrances" to the reference sections for
Word 2007 and for Office 2007 (because some of the VBA macro language
applies to all Office programs, while other parts are specific to
Word). They contain the same topics that are available through the F1
help in the VBA editor.

Word: http://msdn.microsoft.com/en-us/library/bb244391.aspx
Office: http://msdn.microsoft.com/en-us/library/aa432022.aspx

I'm not aware of any other comprehensive reference for "all of the
commands", and examples are often very hard to find.

If you have a specific question, it's best to ask here.
 
G

Graham Mayor

vba help in Word 2007 lists all the commands - most of them with examples.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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