Help with multiple columns & autotext

I

Ivan Debono

Hi all,

I'm using VB6 to read records from a database and insert them into a work
document based on a template that I defined. At the moment I have an
autotextentry with some bookmarks, and I use the following code snippet to
insert the data:

Do While Not tVIEW.EOF
With oDocument.Characters.Last
.Collapse wdCollapseEnd
.Text = oAuto.Name
.InsertAutoText

'Set bookmark values
For Each oField In tVIEW.Fields
.Bookmarks(oField.Name).Range.Text =
oField.Value
Next oField
End With

tVIEW.MoveNext
Loop

Works fine.

Now I would like to implement 2 columns instead of just a list. What and
where are the changes to the autotextentry that I have to do so that I can
still use the above code (more or less) with multiple columns?

Thanks,
Ivan
 
C

Cindy M -WordMVP-

Hi Ivan,
Now I would like to implement 2 columns instead of just a list. What and
where are the changes to the autotextentry that I have to do so that I can
still use the above code (more or less) with multiple columns?
(newspaper type) Columns are section-specific. So if you have a one-column
document, and you want to stick two columns in there to contain the list you
have to insert a continuous section break before and another one after where
the list should come. Then you apply the two-column formatting to that new
section. Insert the AutoText into this position.

IOW, the change has to be made to the code, itself: you need more code
preceding.

OR, you have to insert the AutoText entry, put two section in, format into
two columns, select from section break to section break and recreate the
AutoText entry.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
I

Ivan Debono

The problem is that when I insert the Autotext entries they go to the next
row instead of going to the next column. Can I automatically move to the
next column somehow??
 
C

Cindy M -WordMVP-

Hi Ivan,
The problem is that when I insert the Autotext entries they go to the next
row instead of going to the next column. Can I automatically move to the
next column somehow??
Row? As in a table? You won't be able to insert an AutoText entry into an
existing table and have the contents split up among the cells. Either you
have to recreate the AutoText entry to include the table with the data
already in the cells, or you have to use the newspaper columns I outlined in
my previous message.

And no, you can't make newspaper columns go across, then down.

If you want the user to have a choice whether the list appears as a single
column, or as two columns reading left, right, down, left, right, down then
you'll need to create a second AutoText entry or have your code process the
text once it's been inserted.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
I

Ivan Debono

OK. What defines how many "rows" the section will have?

I've tried all possible combinations and still I get 1 column. Maybe I
haven't enough rows to get the second column!!

Basically the template is structured like this:

-----Continuous Section Break
ItemName
-----Continuous Section Break

Where ItemName is a bookmark and an autotextentry. There are no tables
whatsoever, and the section break is set up as 2 columns. Using this setup
and the code I show in a previous message, should I get multiple columns?

Furthermore, I have 2 templates, one with single column and the other with 2
columns, and the user can select which template to use.

Ivan
 
C

Cindy M -WordMVP-

Hi Ivan,

What version of Word are we discussing, here?

when I made a quick test yesterday, just to make sure I was remembering things
correctly, Word 2003 "balanced out" the columns automatically.

But in some versions of Word, and in documents converted from some file
formats, this didn't used to be automatic; in Tools/Options/Compatibility
there's an option "Don't balance columns for continuous section starts". And
in the versions of Word where this was the default, one needed to add an
additional Continuous section break at the end to force the "balancing out".
OK. What defines how many "rows" the section will have?

I've tried all possible combinations and still I get 1 column. Maybe I
haven't enough rows to get the second column!!

Basically the template is structured like this:

-----Continuous Section Break
ItemName
-----Continuous Section Break

Where ItemName is a bookmark and an autotextentry. There are no tables
whatsoever, and the section break is set up as 2 columns. Using this setup
and the code I show in a previous message, should I get multiple columns?

Furthermore, I have 2 templates, one with single column and the other with 2
columns, and the user can select which template to use.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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