PDA

View Full Version : Solved: Urgent Word Challenge: Formatting Tables Skips Tables



Anne Troy
05-25-2005, 09:35 PM
Hi, guys! This is somewhat of an emergency.

We've had some good Word coders look at this, to no avail.

We've got a procedure behind the form, and a procedure called Issue13.

We are grabbing "objectives" and the next paragraph, and bullets that follow it, and throwing that in a table cell. Forget that part.

We need to grab all the rest of the tables and format them at 10% gray, and it's not grabbing EVERY table.

2 files in the attached zip. Modules is our code. 02 is our sample file. Put 02 into a folder, run the modules file, and choose the folder the 02 is in. Once 02 shows in the userform listbox, hit Start.

Any questions, don't hesitate to ask.

This one is killing us and we need it ASAP (it was due today--Wednesday).

Download the zip from here (http://www.myexpertsonline.com/freedls/wordhelp.zip).

TonyJollans
05-26-2005, 02:58 AM
I have e-mailed you, Anne. Let me know.

Anne Troy
05-26-2005, 05:48 AM
Thanks. I'm checking it out. :)

fumei
05-26-2005, 06:38 AM
Where are the files?

fumei
05-26-2005, 08:53 AM
Never mind, doa, I see them. Will take a look.

Anne Troy
05-26-2005, 09:00 AM
Gerry...this appears to be resolved. Thanks anyway!!

It's 'cause the cells were merged, and the code wasn't formatting merged cells right. The coder realized it about 1 hour before Tony did.

Anne Troy
05-26-2005, 09:01 AM
By the way, guys...thanks for jumping right in. This was so frustrating. It's nice to know that if we hadn't worked it out ourselves, we'd have had the answer anyway!



:)

fumei
05-26-2005, 09:05 AM
Run the Objectives to table conversion, explicitly set it format,. but do that after formating the existing tables.

It is formatting all the tables for me, can you tell me which ones are NOPT for you? Or has Tony's suggestion worked?

MOS MASTER
05-26-2005, 09:45 AM
Hi Ann, Tony and Gerry, :yes

Seams like you've fried this chicken yet!

Could any of you tell us what the sollution was to your problem?

Love to see the code...there's a new thing to be learned every day! :whistle:

TonyJollans
05-26-2005, 11:18 AM
Hi Joost,

If Anne's link is still good you can download the whole thing to have a look - I haven't looked at mosre of it than I needed to.

I can't recall eaxctly but the problem code was along the lines of:

For Each tbl in ActiveDocument
For r = 2 to tbl.rows.count
On Error resume Next
With ...Shading
' do some formatting (shading) of the row
End With
Next
' Do some more formatting of the table
Next
Trouble came when the table had merged rows because then the Rows can't be referenced like that (and the error was being ignored so there was nothing appearing wrong except the lack of formatting). I don't know what solution they went for but I proposed using the cells


For Each tbl in ActiveDocument
For each Cel in tbl.Range.Cells
If Cel.rowindex > 1 then
With Cel.Shading
' do some formatting (shading) of the cell
End With
end If
Next
' Do some more formatting of the table
Next

MOS MASTER
05-26-2005, 11:25 AM
Hi Tony, :yes

Thank you.

You're analyses seams right to me and I had many problems in the past with merged cells and nested tables. (Looping cells is a great idea)

I'll look in to the total thing a bit later because it does seam interesting.

Now Ann....tell us which way you went to the market! :rofl: