Tables and text in a document

W

Wullie

Hi,

I am very new to VBA for word but know my way around Excel, I just can't
seem to grasp the page structure of the doucment in Word, so maybe I'm asking
stupid questions.

I have code in Excel that takes selected data and I want to create a word
document to be printed off from this.

The word document will be formatted as follows

1) Top of page, 1 image, 1 header, same images as before

2) A single line blurb of text

3) Text title values followed by the corresponding variables from the excel
spreadsheet (eg. Course Name - <course>) in 2 cells. <-- I know this will be
best setup as a table, or rather several because these cells are different
lengths/column numbers

4) Another line of blurb

5) A footer table.

What is my best way of going about this?

I tried creating a table, then text, then another table to start myself off
and the blurb text ended up in tthe first cell of the first table.

How do I get the cursor to move out of the table and onto a new paragraph?

I then tried creating text and doing converttotable, but my paragraph
numbers seem to get confused with that (char 1 of a cell is paragraph 1, char
2 is paragraph 2 and stays paragraph 2 until 2nd char of 2nd cell - that
sounds wrong to me), so wouldnt work with placement of variables.

Is my best way to create template and somehow figure out where the variables
will go? If so, anyone have any ideas how to get cell placement on a template?

Any help with the above (rambling) will be greatly appreciated (if
possible), or even a point in the right direction of somewhere I can learn
VBA for word.

Thanks
 
D

Doug Robbins - Word MVP

As it would not be worth the effort for a single document, I assume that you
want to create a series of documents, in which case you should see fellow
MVP Macropod's "Word 97-2007 Catalogue/Directory Mailmerge Tutorial" at:

http://www.wopr.com/index.php?showtopic=731107

or

http://www.gmayor.com/Zips/Catalogue Mailmerge.zip

Do read the tutorial before trying to use the mailmerge document included
with it as you must get the mail merge main document set up exactly as
required.


--
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
 
W

Wullie

Thanks for your feedback Doug. I had a look at that, but it doesn't quite do
what I am looking to do (or maybe it does and I don't quite get it).

The spreadsheet I have is not just a list of people with selected courses.

I have 10 fields at the top of the spreadsheet (course name, Room number,
start/end times etc.) which are on 5 rows.

Then in columns A-C from row 9 downwards holds unit number, unit code and
unit title, from columns D to however many students name and DOB are held in
rows 7 and 8 (no data in A7:C8) and then an 'X' is stored in the
corresponding cell where the persons details and selected course meet.

For example (excluding header details)

Test Person Ann Other Yet Ann Other
01/01/2001 01/01/1970 29/09/2001
Unit Code Mand Units
1 C1 Unit 1 X X X
2 C2 Unit 2 X X X
3 C3 Unit 3 X X X
4 C4 Unit 4 X X X
Unit Code Opt Units
5 C5 Unit 5 X X
6 C6 Unit 6
7 C7 Unit 7
8 C8 Unit 8
9 C9 Unit 9 X X
10 C10 Unit 10 X

What I would like to do is go down each of the units and populate the header
details (on every sheet) and then put the name and DOB of each person who has
selected that unit in a table at the bottom.

In the example above, there would be sheets for the first 4 units showing
all 3 names, a sheet each for unit 5 and 9 with the first 2 peoples details
and another sheet for unit 10 with just the 3 persons details in it.

I have a template already (which is being printed off then manually written
into, which is fine for 1 student doing a course, but not when you have 10
students with 6 selections), so would make most sens to use that if I could
find how to populate the empty boxes of the template.

Let me know if this makes more sense and if there is a good way to do what I
am trying to achieve.

Again, tahnks in advance
 
D

Doug Robbins - Word MVP

You are either in for some heavy duty vba work, or a bit of manipulation of
your data which I think might be easier.

I am not sure how far you have got with the former (you did not show us the
code), but I assume that you have seen the article "Control Word from Excelâ€
at:

http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm


--
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
 

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