L
Loci
I have created an invoice template with some code in the background as shown below:
I am using a table formula to add up all the cell values and therefore require 0 to be entered where a value is not, I would then like to hide all the zero values by changing them to a white font. At this point I say if the selection.text = "0.00" then... however the value received by the code is 0.00££ How can I check for the zero values nad include or remove the trailing sqaures and what are they??
Sub ReCalcCodes()
' recalc all field codes in table and select total field
' Set all zero values in table cells to white font
Dim r As Integer
Dim c As Integer
Dim tbrows As Integer
' Select table and update field values.
ActiveDocument.Tables(1).Select
Selection.Fields.Update
r = 3
c = 3
tbrows = 1
While tbrows < 23
ActiveDocument.Tables(1).Cell(Row:=r, Column:=c).Select
If Selection.Text = "0.00" Then
With Selection.Font
.Color = wdColorWhite
End With
Else
With Selection.Font
.Color = wdColorAutomatic
End With
End If
r = r + 1
tbrows = tbrows + 1
Wend
ActiveDocument.Bookmarks("total").Select
End Sub
Many thanks for any help you can give.
loci
I am using a table formula to add up all the cell values and therefore require 0 to be entered where a value is not, I would then like to hide all the zero values by changing them to a white font. At this point I say if the selection.text = "0.00" then... however the value received by the code is 0.00££ How can I check for the zero values nad include or remove the trailing sqaures and what are they??
Sub ReCalcCodes()
' recalc all field codes in table and select total field
' Set all zero values in table cells to white font
Dim r As Integer
Dim c As Integer
Dim tbrows As Integer
' Select table and update field values.
ActiveDocument.Tables(1).Select
Selection.Fields.Update
r = 3
c = 3
tbrows = 1
While tbrows < 23
ActiveDocument.Tables(1).Cell(Row:=r, Column:=c).Select
If Selection.Text = "0.00" Then
With Selection.Font
.Color = wdColorWhite
End With
Else
With Selection.Font
.Color = wdColorAutomatic
End With
End If
r = r + 1
tbrows = tbrows + 1
Wend
ActiveDocument.Bookmarks("total").Select
End Sub
Many thanks for any help you can give.
loci