View Single Post
 
Old 09-22-2015, 01:32 PM
jc491's Avatar
jc491 jc491 is offline Windows 7 64bit Office 2013
VBA Novice
 
Join Date: Sep 2015
Location: UK
Posts: 55
jc491 is on a distinguished road
Default VBA Word Table - Select More than 1 Column at a time - Apply Formatting

Hi all,


I apolgise if there is a solution already on here, I have not been able to locate it.

I have been trying to solve this problem.

I have tables that I need to format.

I would like to select a number of columns.

I know how to select 1 column and format it.

Can any one advise on how I may be able to select for

example


columns 3, 7 ,9 or any other columns I need to select.

I have looked at and tested various code snippets from:
https://msdn.microsoft.com/en-us/lib.../ff195142.aspx



I still can't work it out.
Code:
Sub FormatColumns()
ActiveDocument.Tables(1).Columns(6).Select
With Selection.Borders(wdBorderLeft)
  .ColorIndex = wdWhite
End With
With Selection.Borders(wdBorderRight)
  .ColorIndex = wdWhite
End With
With Selection.Borders(wdBorderTop)
  .ColorIndex = wdWhite
End With
With Selection.Borders(wdBorderBottom)
  .ColorIndex = wdWhite
End With
With Selection.Borders(wdBorderHorizontal)
  .ColorIndex = wdWhite
End With
End Sub
I am pretty sure that I'm misunderstanding the syntax somewhere.

is this possible:
ActiveDocument.Tables(1).Columns(3,6,9).Select


Later I would like to use the same logic to select multiple rows.


Any advice I would appreciate

Thank you in advance for your time

J

Last edited by macropod; 09-22-2015 at 10:04 PM. Reason: Added code tags & formating
Reply With Quote