PC Review


Reply
Thread Tools Rate Thread

cannot set word column widths

 
 
=?Utf-8?B?RGFycmVuIExhIFBhZHVsYQ==?=
Guest
Posts: n/a
 
      2nd Jun 2005
Hey all

I generate a word document from an access script. I generate a new table
inside the new document. I preset the table with a specified number of
columns and rows (using variables from a form input) and then merge all
columns in the first two rows for headers I write there. Because of the
merging, it will not allow me to specify preferred column widths. A message
comes up stating that it cannot isolate those columns because there are cells
of different widths. Here's my code:

Set tblNew = docActive.Tables.Add( _
Range:=docActive.Range(Start:=0, End:=0), NumRows:=totalrows,
NumColumns:=totalcols)
intCount = 1
tblNew.Borders.OutsideLineStyle = wdLineStyleSingle
tblNew.Borders.InsideLineStyle = wdLineStyleSingle
docActive.Range(tblNew.Cell(1, 1).Range.Start, tblNew.Cell(1,
totalcols).Range.End).Cells.Merge
tblNew.Cell(1, 1).Range.InsertAfter Header
tblNew.Cell(1, 1).Range.Font.Name = "Helvetica"
tblNew.Cell(1, 1).Range.Font.Bold = True
tblNew.Cell(1, 1).Range.Font.Size = 18
tblNew.Cell(1, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter

docActive.Range(tblNew.Cell(2, 1).Range.Start, tblNew.Cell(2,
totalcols).Range.End).Cells.Merge
tblNew.Cell(2, 1).Range.InsertAfter Subhead
tblNew.Cell(2, 1).Range.Font.Name = "Helvetica"
tblNew.Cell(2, 1).Range.Font.Bold = True
tblNew.Cell(2, 1).Range.Font.Size = 16
tblNew.Cell(2, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter

tblNew.Cell(3, 1).Range.InsertAfter "Rank"
tblNew.Cell(3, 1).Range.Font.Name = "Helvetica"
tblNew.Cell(3, 1).Range.Font.Bold = True
tblNew.Cell(3, 1).Range.Font.Size = 7
tblNew.Cell(3, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
tblNew.Cell(3, 1).Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
tblNew.Cell(3, 1).Range.Borders(wdBorderRight).LineStyle = wdLineStyleNone

At this point I attempt to at least set preferred cell widths for these
cells - the first cell I set at .65 inches, the second at 2. As soon as the
second cell, 2nd column on 3rd row is written at 2 inches, the whole table
goes off the right margin because it auto sets all other cells (the contents
of which have not yet been written to it) at .95 inches as a default. So then
I tried setting column widths, but then I got the message described earlier.
So I set NO widths at all, and my page setup and margins are kept intact, but
the user then has to manually set the column widths in word.

Any ideas? I know this explanation probably sucks, but my brain is shutting
down.
Thanks for any help.

--
Darren La Padula
 
Reply With Quote
 
 
 
 
John Nurick
Guest
Posts: n/a
 
      3rd Jun 2005
Two thoughts.

1) If the headers are full width, write them in ordinary paragraphs
before the table, hence avoiding the need to merge cells.

2) Set the column widths you need before merging the cells.


On Thu, 2 Jun 2005 15:18:04 -0700, "Darren La Padula"
<(E-Mail Removed)> wrote:

>Hey all
>
>I generate a word document from an access script. I generate a new table
>inside the new document. I preset the table with a specified number of
>columns and rows (using variables from a form input) and then merge all
>columns in the first two rows for headers I write there. Because of the
>merging, it will not allow me to specify preferred column widths. A message
>comes up stating that it cannot isolate those columns because there are cells
>of different widths. Here's my code:
>
> Set tblNew = docActive.Tables.Add( _
> Range:=docActive.Range(Start:=0, End:=0), NumRows:=totalrows,
>NumColumns:=totalcols)
> intCount = 1
> tblNew.Borders.OutsideLineStyle = wdLineStyleSingle
> tblNew.Borders.InsideLineStyle = wdLineStyleSingle
>docActive.Range(tblNew.Cell(1, 1).Range.Start, tblNew.Cell(1,
>totalcols).Range.End).Cells.Merge
> tblNew.Cell(1, 1).Range.InsertAfter Header
> tblNew.Cell(1, 1).Range.Font.Name = "Helvetica"
> tblNew.Cell(1, 1).Range.Font.Bold = True
> tblNew.Cell(1, 1).Range.Font.Size = 18
> tblNew.Cell(1, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
>
> docActive.Range(tblNew.Cell(2, 1).Range.Start, tblNew.Cell(2,
>totalcols).Range.End).Cells.Merge
> tblNew.Cell(2, 1).Range.InsertAfter Subhead
> tblNew.Cell(2, 1).Range.Font.Name = "Helvetica"
> tblNew.Cell(2, 1).Range.Font.Bold = True
> tblNew.Cell(2, 1).Range.Font.Size = 16
> tblNew.Cell(2, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
>
> tblNew.Cell(3, 1).Range.InsertAfter "Rank"
> tblNew.Cell(3, 1).Range.Font.Name = "Helvetica"
> tblNew.Cell(3, 1).Range.Font.Bold = True
> tblNew.Cell(3, 1).Range.Font.Size = 7
> tblNew.Cell(3, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
> tblNew.Cell(3, 1).Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
> tblNew.Cell(3, 1).Range.Borders(wdBorderRight).LineStyle = wdLineStyleNone
>
>At this point I attempt to at least set preferred cell widths for these
>cells - the first cell I set at .65 inches, the second at 2. As soon as the
>second cell, 2nd column on 3rd row is written at 2 inches, the whole table
>goes off the right margin because it auto sets all other cells (the contents
>of which have not yet been written to it) at .95 inches as a default. So then
>I tried setting column widths, but then I got the message described earlier.
>So I set NO widths at all, and my page setup and margins are kept intact, but
>the user then has to manually set the column widths in word.
>
>Any ideas? I know this explanation probably sucks, but my brain is shutting
>down.
>Thanks for any help.


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Reply With Quote
 
=?Utf-8?B?RGFycmVuIExhIFBhZHVsYQ==?=
Guest
Posts: n/a
 
      3rd Jun 2005
Thanks

1. The two top banners need to be in the table because they require the same
perimeter lines as the rest of the table. I'll see if I can separate them,
but I need the lines connecting so don't know if word will accomodate that
without some space between the two.

2. I tried setting the column widths before merging the cells, but as soon
as the merge occurred, all column widths reverted to a default of .97 inches.
VERY annoying.

"John Nurick" wrote:

> Two thoughts.
>
> 1) If the headers are full width, write them in ordinary paragraphs
> before the table, hence avoiding the need to merge cells.
>
> 2) Set the column widths you need before merging the cells.
>
>
> On Thu, 2 Jun 2005 15:18:04 -0700, "Darren La Padula"
> <(E-Mail Removed)> wrote:
>
> >Hey all
> >
> >I generate a word document from an access script. I generate a new table
> >inside the new document. I preset the table with a specified number of
> >columns and rows (using variables from a form input) and then merge all
> >columns in the first two rows for headers I write there. Because of the
> >merging, it will not allow me to specify preferred column widths. A message
> >comes up stating that it cannot isolate those columns because there are cells
> >of different widths. Here's my code:
> >
> > Set tblNew = docActive.Tables.Add( _
> > Range:=docActive.Range(Start:=0, End:=0), NumRows:=totalrows,
> >NumColumns:=totalcols)
> > intCount = 1
> > tblNew.Borders.OutsideLineStyle = wdLineStyleSingle
> > tblNew.Borders.InsideLineStyle = wdLineStyleSingle
> >docActive.Range(tblNew.Cell(1, 1).Range.Start, tblNew.Cell(1,
> >totalcols).Range.End).Cells.Merge
> > tblNew.Cell(1, 1).Range.InsertAfter Header
> > tblNew.Cell(1, 1).Range.Font.Name = "Helvetica"
> > tblNew.Cell(1, 1).Range.Font.Bold = True
> > tblNew.Cell(1, 1).Range.Font.Size = 18
> > tblNew.Cell(1, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
> >
> > docActive.Range(tblNew.Cell(2, 1).Range.Start, tblNew.Cell(2,
> >totalcols).Range.End).Cells.Merge
> > tblNew.Cell(2, 1).Range.InsertAfter Subhead
> > tblNew.Cell(2, 1).Range.Font.Name = "Helvetica"
> > tblNew.Cell(2, 1).Range.Font.Bold = True
> > tblNew.Cell(2, 1).Range.Font.Size = 16
> > tblNew.Cell(2, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
> >
> > tblNew.Cell(3, 1).Range.InsertAfter "Rank"
> > tblNew.Cell(3, 1).Range.Font.Name = "Helvetica"
> > tblNew.Cell(3, 1).Range.Font.Bold = True
> > tblNew.Cell(3, 1).Range.Font.Size = 7
> > tblNew.Cell(3, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
> > tblNew.Cell(3, 1).Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
> > tblNew.Cell(3, 1).Range.Borders(wdBorderRight).LineStyle = wdLineStyleNone
> >
> >At this point I attempt to at least set preferred cell widths for these
> >cells - the first cell I set at .65 inches, the second at 2. As soon as the
> >second cell, 2nd column on 3rd row is written at 2 inches, the whole table
> >goes off the right margin because it auto sets all other cells (the contents
> >of which have not yet been written to it) at .95 inches as a default. So then
> >I tried setting column widths, but then I got the message described earlier.
> >So I set NO widths at all, and my page setup and margins are kept intact, but
> >the user then has to manually set the column widths in word.
> >
> >Any ideas? I know this explanation probably sucks, but my brain is shutting
> >down.
> >Thanks for any help.

>
> --
> John Nurick [Microsoft Access MVP]
>
> Please respond in the newgroup and not by email.
>

 
Reply With Quote
 
John Nurick
Guest
Posts: n/a
 
      3rd Jun 2005
I hate it when Word doesn't work the way I think it ought to. Best seek
advice in a Word forum, e.g. microsoft.public.word.tables or
microsoft.public.word.vba.general.

On Fri, 3 Jun 2005 06:24:02 -0700, "Darren La Padula"
<(E-Mail Removed)> wrote:

>Thanks
>
>1. The two top banners need to be in the table because they require the same
>perimeter lines as the rest of the table. I'll see if I can separate them,
>but I need the lines connecting so don't know if word will accomodate that
>without some space between the two.
>
>2. I tried setting the column widths before merging the cells, but as soon
>as the merge occurred, all column widths reverted to a default of .97 inches.
>VERY annoying.
>
>"John Nurick" wrote:
>
>> Two thoughts.
>>
>> 1) If the headers are full width, write them in ordinary paragraphs
>> before the table, hence avoiding the need to merge cells.
>>
>> 2) Set the column widths you need before merging the cells.
>>
>>
>> On Thu, 2 Jun 2005 15:18:04 -0700, "Darren La Padula"
>> <(E-Mail Removed)> wrote:
>>
>> >Hey all
>> >
>> >I generate a word document from an access script. I generate a new table
>> >inside the new document. I preset the table with a specified number of
>> >columns and rows (using variables from a form input) and then merge all
>> >columns in the first two rows for headers I write there. Because of the
>> >merging, it will not allow me to specify preferred column widths. A message
>> >comes up stating that it cannot isolate those columns because there are cells
>> >of different widths. Here's my code:
>> >
>> > Set tblNew = docActive.Tables.Add( _
>> > Range:=docActive.Range(Start:=0, End:=0), NumRows:=totalrows,
>> >NumColumns:=totalcols)
>> > intCount = 1
>> > tblNew.Borders.OutsideLineStyle = wdLineStyleSingle
>> > tblNew.Borders.InsideLineStyle = wdLineStyleSingle
>> >docActive.Range(tblNew.Cell(1, 1).Range.Start, tblNew.Cell(1,
>> >totalcols).Range.End).Cells.Merge
>> > tblNew.Cell(1, 1).Range.InsertAfter Header
>> > tblNew.Cell(1, 1).Range.Font.Name = "Helvetica"
>> > tblNew.Cell(1, 1).Range.Font.Bold = True
>> > tblNew.Cell(1, 1).Range.Font.Size = 18
>> > tblNew.Cell(1, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
>> >
>> > docActive.Range(tblNew.Cell(2, 1).Range.Start, tblNew.Cell(2,
>> >totalcols).Range.End).Cells.Merge
>> > tblNew.Cell(2, 1).Range.InsertAfter Subhead
>> > tblNew.Cell(2, 1).Range.Font.Name = "Helvetica"
>> > tblNew.Cell(2, 1).Range.Font.Bold = True
>> > tblNew.Cell(2, 1).Range.Font.Size = 16
>> > tblNew.Cell(2, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
>> >
>> > tblNew.Cell(3, 1).Range.InsertAfter "Rank"
>> > tblNew.Cell(3, 1).Range.Font.Name = "Helvetica"
>> > tblNew.Cell(3, 1).Range.Font.Bold = True
>> > tblNew.Cell(3, 1).Range.Font.Size = 7
>> > tblNew.Cell(3, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
>> > tblNew.Cell(3, 1).Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
>> > tblNew.Cell(3, 1).Range.Borders(wdBorderRight).LineStyle = wdLineStyleNone
>> >
>> >At this point I attempt to at least set preferred cell widths for these
>> >cells - the first cell I set at .65 inches, the second at 2. As soon as the
>> >second cell, 2nd column on 3rd row is written at 2 inches, the whole table
>> >goes off the right margin because it auto sets all other cells (the contents
>> >of which have not yet been written to it) at .95 inches as a default. So then
>> >I tried setting column widths, but then I got the message described earlier.
>> >So I set NO widths at all, and my page setup and margins are kept intact, but
>> >the user then has to manually set the column widths in word.
>> >
>> >Any ideas? I know this explanation probably sucks, but my brain is shutting
>> >down.
>> >Thanks for any help.

>>
>> --
>> John Nurick [Microsoft Access MVP]
>>
>> Please respond in the newgroup and not by email.
>>


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different widths for each column in a 100% stacked column chart Chart Explorer Microsoft Excel Charting 1 21st May 2009 09:19 AM
HOW DO I CREATE TWO COLUMN WIDTHS IN ONE COLUMN DIFFERENT ROW IN E LIZZIE Microsoft Excel New Users 1 12th Jan 2008 11:17 PM
Multiple Column Report With Varying Column Widths =?Utf-8?B?bWNnag==?= Microsoft Access 5 5th Nov 2006 08:28 PM
I wish to have multiple column widths for a the same column. =?Utf-8?B?R2FyeSBEaWtpbg==?= Microsoft Excel Worksheet Functions 4 6th Jun 2005 08:09 PM
Re: Word - creating a table and changing column widths half way through John O Microsoft Powerpoint 0 5th Apr 2004 06:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:06 AM.