Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word97 - Alignment Problem

Status
Not open for further replies.

SHardy

Programmer
May 9, 2001
231
GB
I am trying to put together a mail merge letter within Word97. However, I am having problems with aligning information at the top of the page.

I want to display useful information at the top of the page, like this:

Client's Company: ACME Inc.
Helpline Number: 01234 56789
Reference Number: 12345

I want the text to align together at the colons, with the longest field to be right aligned.

It seems that the best/ easiest way of aligning at the colons is to enter the text & fields into a table. However, the problem that I then have is that the company name can vary quite drastically in length. Is there anyway to make the column widths automatically adjust to fit the contents, while also keeping the whole table right aligned to the margin?

Any alternatives to acheiving what I want would also be appreciated.

Thanks,
S
 
Right I did sort this one out, however I do now have another problem with it.

I set the row heights to an exact value, rather than autofit. I then managed to right align the table. My macro, detailed, above then selects the table and auto fits the column widths. This it does, by moving the start position of the table to keep it right aligned. As long as I saved the document in "view merged data" view.

All magic upto this point.

However, when I then put into into the test version of the system that it is intended for, I didn't have such luck.

I can't have the macro running on the Document _Open event. The system runs on a Citrix application. Therefore it is running on a remote server. Also the Word app that it starts is also running on the same server.
The merge document has no data source set. When the application opens the document, it sets the data source, merges the data, and closes the merge document, keeping open only the merged document. All this happens only AFTER my Document_Open macro.
I cannot add a button to the toolbar, as it's a remote session of Word.

Therefore I need another event to trigger the macro. Something along the lines of:
Before printing
Before formatting the page for printing
After merge

Any other possible ideas?

As far as I can tell, there aren't actually many events within Word to use.

Thanks,
S
 
OK, I am able to do this via a command bar button in the remote Word session. I put the code and the custom command bar into the remote server's Normal.dot Word template.

So, this now works, but involves the user clicking the command bar button. It would still obviously be better if it were to AutoFit automatically.

Also, after a bit of playing, I have another problem also. When I AutoFit the column widths, it will take the second column to 8.83cm. However, the longest allowed field length would need this to go to nearly 10cm. As there are only two columns, and the first is 3cm, then there is plenty of room on the page for it to stretch out a bit more. I am able to get the desired layout by manually resizing the columns. So I don't understand why the AutoSize doesn't like it.
 
Ok, a bit of a wierd one with this AutoFit problem.

If I start, or open, any document and add a table, the AutoFit works with no problems.

If I open my mail merge document prior to merge, the AutoFit works for the existing table.

When I launch the mail merge document via the Citrix application, the AutoFit does NOT work properly for the existing table. It seems to have a maximum width that it likes. Even if the column is wider to begin with.

However, keeping this merged document open, if I edit the doc and add a new table, the AutoFit works fine on this new table. The columns will go as wide as is necessary.

Can any one shed any light?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top