Sorry Sorry ...
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
HTH
Cheers
Carim
A couple of ideas :
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 ...
HTH
Cheers
Carim
Compass Rose - 17 Oct 2006 14:51 GMT
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.
> A couple of ideas :
>
[quoted text clipped - 11 lines]
> Cheers
> Carim
Compass Rose - 17 Oct 2006 15:22 GMT
Correction:
'If any new text is added to column 2, ....' should read 'If any new text is
added to any of the cells of column 2, ....'
> I realize that I wasn't specific enough in my description of what I am trying
> to achieve, in an attempt to be brief.
[quoted text clipped - 22 lines]
> > Cheers
> > Carim
Carim - 17 Oct 2006 15:33 GMT
Could " Tools Track Changes Highlight Changes" be a solution ?
Carim
Compass Rose - 17 Oct 2006 17:04 GMT
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.
> Could " Tools Track Changes Highlight Changes" be a solution ?
>
> Carim
Carim - 17 Oct 2006 17:30 GMT
Hi,
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
Compass Rose - 18 Oct 2006 00:17 GMT
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?
> Hi,
>
[quoted text clipped - 11 lines]
> repetitive inputs ...
> Carim
Carim - 18 Oct 2006 08:41 GMT
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
HTH
Carim
Compass Rose - 18 Oct 2006 15:44 GMT
That did the trick!! Thanks so much for your help. I learned a lot in the
process.
David
> Sub Bold4()
> Dim Tbl As Table
[quoted text clipped - 10 lines]
> HTH
> Carim
Carim - 18 Oct 2006 16:08 GMT
Hi,
Glad I could help ... Thanks for the feedback ...
It gave me the opportunity to leave my Excel planet for a short
while...
Cheers
Carim