A
Anne Schouten
Who can help me????
I use Word 2000.
In the file are many tables.
After entering a number in certain cells with a text field I want to have a
valuta sign in de cell left of it.
If the cell is empty then the cell left of it must be empty too.
Therefore I made a macro and linked that to the text field.
The problem is that the macro often causes Word to shut-down. Mainly while
moving from an empty cell to an other cell.
I also tested the macro in Word 2003. Then there is no problem at all.
Moreover I would like to switch Screenupdating off and on, but then Word
looses its inserting point. In the newsgroups I found the advice to use
Ranges instead of Selection, but how do I use ranges for filling a cell with
text in the active table.
the code I made is as follows:
Dim aDoc As Document
If Selection.Information(wdWithInTable) = True Then
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
End If
With Selection
.SelectCell
If IsNumeric(Left(.Text, Len(.Text) - 2)) Then
.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove
.Text = "?"
Else
.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove
.Delete
End If
End With
Else
MsgBox "Not in table"
End If
If aDoc.ProtectionType = wdNoProtection Then
aDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
I use Word 2000.
In the file are many tables.
After entering a number in certain cells with a text field I want to have a
valuta sign in de cell left of it.
If the cell is empty then the cell left of it must be empty too.
Therefore I made a macro and linked that to the text field.
The problem is that the macro often causes Word to shut-down. Mainly while
moving from an empty cell to an other cell.
I also tested the macro in Word 2003. Then there is no problem at all.
Moreover I would like to switch Screenupdating off and on, but then Word
looses its inserting point. In the newsgroups I found the advice to use
Ranges instead of Selection, but how do I use ranges for filling a cell with
text in the active table.
the code I made is as follows:
Dim aDoc As Document
If Selection.Information(wdWithInTable) = True Then
If aDoc.ProtectionType <> wdNoProtection Then
aDoc.Unprotect
End If
With Selection
.SelectCell
If IsNumeric(Left(.Text, Len(.Text) - 2)) Then
.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove
.Text = "?"
Else
.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove
.Delete
End If
End With
Else
MsgBox "Not in table"
End If
If aDoc.ProtectionType = wdNoProtection Then
aDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If