Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / June 2007

Tip: Looking for answers? Try searching our database.

Using Macros to Style Multiple Table Rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
briesmith - 25 Jun 2007 16:19 GMT
I want to apply a styling macro to a selection of rows in a table. I can make
the macro work easily enough but it only does its stuff on the topmost or
first row I have selected.
I want it to format multiple rows (selected using CTRL+RowSelect (right
pointing arrow outside table pointing to desired row)).
It needs to ask itself "have multiple rows been selected?" and if yes, move
down through the table finding all the selected rows and applying the macro
to them as it finds them.
PS I would use the table style tools but they prescribe the rows and cells
you can work on; eg header, last row, top left cell etc. If they included an
option "selected row" or "selected cell" I wouldn't have had to trouble you.
Thank you in advance for any help you can give.
Doug Robbins - Word MVP - 26 Jun 2007 10:12 GMT
You probably need to be applying the formatting to the .Range of the
Selection.

Just what does the macro do?

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I want to apply a styling macro to a selection of rows in a table. I can
>make
[quoted text clipped - 13 lines]
> you.
> Thank you in advance for any help you can give.
briesmith - 26 Jun 2007 14:07 GMT
Hello Doug

Thanks for troubling to reply. The macro does the following
LineWidth = wdLineWidth050pt
           .Color = wdColorAutomatic
       End With
       .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
       .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
       .Borders.Shadow = False
   End With
   With Options
       .DefaultBorderLineStyle = wdLineStyleSingle
       .DefaultBorderLineWidth = wdLineWidth050pt
       .DefaultBorderColor = wdColorAutomatic
   End With
   Selection.Font.Name = "Arial"
   Selection.Font.Size = 8
   Selection.Font.Bold = wdToggle
   Selection.Font.Color = wdColorWhite
   Selection.Font.Color = wdColorWhite
End Sub
Sub TblHdr()
'
' TblHdr Macro
' Macro recorded 6/26/2007 by Brian E Smith
'
   With Selection.Cells.Shading
       .Texture = wdTextureNone
       .ForegroundPatternColor = wdColorAutomatic
       .BackgroundPatternColor = wdColorIndigo
   End With
   With Options
       .DefaultBorderLineStyle = wdLineStyleSingle
       .DefaultBorderLineWidth = wdLineWidth050pt
       .DefaultBorderColor = wdColorAutomatic
   End With
   Selection.Font.Name = "Arial"
   Selection.Font.Size = 8
   Selection.Font.Color = wdColorWhite
   Selection.Font.Bold = wdToggle
End Sub

I hope this helps.

Brian Smith

> You probably need to be applying the formatting to the .Range of the
> Selection.
[quoted text clipped - 18 lines]
> > you.
> > Thank you in advance for any help you can give.
briesmith - 26 Jun 2007 14:12 GMT
Hello Doug

I don't know if it's relevant but the selected rows probably won't be
adjacent or contiguous but rather selected at varying intervals down the
table.

Brian

> Hello Doug
>
[quoted text clipped - 64 lines]
> > > you.
> > > Thank you in advance for any help you can give.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.