another confusion, I am not attentive enough ...
Could the following be of any help :
Sub Bold2()
Dim oCel As Cell
ActiveDocument.Tables(1).Columns(2).Select
For Each oCel In Selection.Range.Cells
oCel.Range.Font.Bold = True
Next
End Sub
1. At the design stage, if your whole table is still empty, you can set
Column 2 as Bold, and future entries will be automatically bold ... or,
2. More complex, you could write an application event procedure which
would fire on WindowSelectionChange and test the value of
Selection.Cells(1).ColumnIndex ,
if this value is 2 , it will apply Selection.Font.Bold = True
Again all my apologies for the Excel - Word confusion ...
I realize that I wasn't specific enough in my description of what I am trying
to achieve, in an attempt to be brief.
I have an existing table with 3 columns in a document. The entire table is
formatted as regular text. If any new text is added to column 2, I want it to
be formatted BOLD, so that someone reading the table will realize that this
new text has been added. The new text will always appear at the end of the
existing text - never in the middle. I realize that the person can hit Ctrl+B
before typing the new text, but I want to eliminate that requirement, if
possible.
Thanks, but I already considered that. It creates too many other problems as
far as typing changes in other locations of the document. Because my macro
does other manipulation of the table, I was hoping to be able to add a few
lines to the macro that would change the formatting of all new text typed in
the cells in column 2 to BOLD but leave all of the exisiing text in the cells
of column 2 as regular formatting.
For example, what would the code be for starting with the first cell of
column 2, going to the end of each cell in column 2, changing the formatting
to BOLD and then inserting a SPACE? Any new text added after the SPACE would
be BOLD. Being new to VBA, I don't know the structure of a 'For Each oCell'
loop or a 'For...Next' loop that would accomplish this.
Sub Bold3()
Dim oCel As Cell
ActiveDocument.Tables(1).Columns(2).Select
For Each oCel In Selection.Range.Cells
oCel.EndKey Unit:=wdLine ' moves to end
oCel.Font.Bold = wdToggle ' changes to bold
oCel.TypeText Text:=" " ' adds a space
Next
End Sub
Hope this can help ... I am not sure about how you plan to track
repetitive inputs ...
Carim
Well, we're making progress, but when I try to run the code, I get a compile
error at the statement 'oCel.EndKey'. The compile error is 'Method or data
error not found'. Any thoughts?
Sub Bold4()
Dim Tbl As Table
Dim i As Long
Set Tbl = ActiveDocument.Tables(1)
For i = 1 To Tbl.Rows.Count
Tbl.Cell(i, 2).Select
Selection.EndKey Unit:=wdLine ' moves to end
Selection.Font.Bold = wdToggle ' changes to bold
Selection.TypeText Text:=" " ' adds a space
Next i
End Sub