Hi Beever,
OK, if I'm following this correctly, the main problem is that Word isn't giving
you static column widths for the table that defines the stickers?
You can specify static column widths when you create the table. Look at the Word
VBA Help for the Tables.Add method and pay special attention to the
information for the parameter DefaultTableBehavior:
DefaultTableBehavior Optional Variant. Sets a value that specifies whether
Microsoft Word automatically resizes cells in tables to fit the cells’ contents
(AutoFit). Can be either of the following constants: wdWord8TableBehavior
(AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default
constant is wdWord8TableBehavior.
After the fact, you can set the AllowAutoFit property to False.
Personally, I prefer to take care of this when creating the table, as it will
speed the process considerably. Dynamic calculation of column width and laying
the table out on the page for "every character" is extremely resource intensive.
My Access Table contains details Like Product Code, Description and Weight.
The user wants to print these details on small stickers to be pasted on the
products. Each info will be on separate lines, hence the font size has to be
small (around 4 or 5). I tried to do this using Word Table. I am able to
populate the cells correctly, each cell containing 3 separate lines. One
problem is that, the Word document being created in not able to draw the
Table properly and align the data correctly. Since I was not able to create
colums with a fixed width (I was planning to assign the even numbered columns
to represent the gaps and borders on two stickers on the same row), I placed
spaces on either sides of the strings on each line. But the values are not
being center aligned. After creating the document, I have to manually select
the Table and align it again. Even then, I am facing some problems like
correct alligning, improper gap adjustment, etc. Is there a better way to
print the details on stickers (Each sheet contains 11 columns across and 10
rows, i.e. 11 * 10 = 110 stickers)?? I might have to change the Sheet size,
No. of rows and columns on each sheet, sticker size and gaps between columns
and rows. (The user is likely to change the Font Size depending upon the
availability of sticker sizes). I though that since Word has a feature to
print Labels and Stickers, I could execute it using VBA. But I was not able
to get any help.
I am using VisualBasic 6 SP6 and Word XP/2003.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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