![]() |
#2
|
||||
|
||||
![]()
It is probably best to error trap each table to ensure that you are processing the correct tables e.g. as follows. I have assumed each table has six cells - change each as appropriate. However why do you need to change the tables? Wouldn't it be better to create your document from a template that already has the masthead correctly formatted?
Code:
Dim oTable As Table Dim i As Integer If ActiveDocument.Tables.Count > 3 Then If ActiveDocument.Tables(1).Range.Cells.Count = 6 And _ ActiveDocument.Tables(2).Range.Cells.Count = 6 And _ ActiveDocument.Tables(3).Range.Cells.Count = 6 And _ ActiveDocument.Tables(4).Range.Cells.Count = 6 And _ ActiveDocument.Tables(4).Range.Information(wdActiveEndPageNumber) = 1 Then For i = 1 To 4 Set oTable = ActiveDocument.Tables(i) 'Do something with otable e.g. oTable.Cell(1, 1).Range.Text = "Test" Next i End If End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Looking for a macro for word count in one specific column of table, only rows with white background | mobj | Word VBA | 2 | 10-17-2019 03:09 AM |
![]() |
JellehFishh | Word VBA | 2 | 06-27-2019 08:23 AM |
Linking Specific text fields in PP to specific cells in an Excel table | GWRW1964 | PowerPoint | 0 | 02-26-2018 07:37 AM |
![]() |
jc491 | Word VBA | 8 | 09-30-2015 06:10 AM |
![]() |
Lebber | Word | 9 | 02-01-2013 12:31 AM |