Hi Folks,
This code used to work, but six months or so ago, it started doing the wrong thing...
The code:
Code:
Private Sub cmdMakeColLeft_Click()
On Error GoTo ErrorHandler
Dim Lstr As String, aCell As Cell
Selection.InsertColumns
Lstr = Me.txtColLeftText
For Each aCell In Selection.Cells
aCell.Range.Text = Lstr
Next aCell
Selection.MoveRight Unit:=wdCell
Exit Sub
ErrorHandler:
MsgBox "Only works from inside a table."
End Sub
A screenshot of some tables:
The code gets called from a GUI form. If I click on the top table, in the cell that has
Rater 1
Teacher
and enter "Teacher" into the txtColLeftText box, then when I execute the code, it is supposed to make the second table in the image.
A column is added to the left, and the text is enter (only) into the new column.
Lately, it has been erroneously replacing the text in the original column too (like the bottom table).
Any ideas how to fix this? Hopfully I explained the problem well.
-steve