VBA Word Table style bug?
-
giovedì 5 aprile 2012 08:04
Hi all,
I have created a macro, attached to a button on my word document, which added a new row to the top of a table and changes the colour of the bottom line of the row to light grey. However there appears to be a problem which I think is a bug in either the language or word itself which meant that the part of my function which colours the bottom of the row only works once!
I did create a work around which was to actually call the style function twice (but it had to apply a different colour, even though only one of the colours are actually applied). Can someone have a look and see if it is something silly im doing, or do you see the same problem?
Private Sub NewEntry_Click() 'Select first row ActiveDocument.Tables(1).Rows.First.Range.Select 'Insert row at the top Selection.InsertRowsAbove 'Format the cell so that the bottom line style is light grey, near invisible With ActiveDocument.Tables(1).Rows.First.Range 'This is done twice as I believe there is a bug in word which means that if you only 'put it once then it only works once. However, I found that if you do it twice, actually 'each needs to be different hence the two different colours, then it appears 'to work correctly, and actually only one of the colours still appears! .Borders(wdBorderBottom).Color = wdColorGray10 .Borders(wdBorderBottom).Color = wdColorGray05 End With End Sub
Cheers,
Chris
Tutte le risposte
-
giovedì 5 aprile 2012 08:37
hi Chris
looks like you want the VBA Forum
“This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.”
- Proposto come risposta Heslacher giovedì 5 aprile 2012 08:40
- Contrassegnato come risposta jamesongroves giovedì 5 aprile 2012 08:46
-
giovedì 5 aprile 2012 08:45
Apologies, you are correct.
I have reposted it here: http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/87c36a65-5a16-4afb-8395-37f15a566db4
If a moderator wishes to remove this post that's cool with me.
Thanks

