This is what I came up with. It seems to work.
'_______________________________________
Sub Divide1002()
Dim myValue2 As Single
ActiveDocument.Unprotect
With
ActiveDocument.FormFields(Selection.Bookmarks(Sele ction.Bookmarks.Count).Nam
e)
myValue2 = CSng(Left(.Result, Len(.Result) - 1))
myValue2 = myValue2 / 10000
.Result = CStr(myValue2)
End With
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
'_______________________________________
"Jean-Guy Marcil" wrote in message
...
Darryl was telling us:
Darryl nous racontait que :
Success!
But one question. In the divide100 subroutine, it references Value1.
If I have three
form fields (value1, value2, value3) and I want to call divide100
onexit of each, how
would I modify the divide100 (put a conditional test ?)
Try something like this:
'_______________________________________
Sub Divide100()
Dim myValue As Single
ActiveDocument.Unprotect
With Selection.Range.Bookmarks(1).Range.FormFields(1)
If .Result = "" Then GoTo QuitSub 'in case field is empty
myValue = CSng(Left(.Result, Len(.Result) - 1))
myValue = myValue / 10000
.Result = CStr(myValue)
End With
QuitSub:
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
'_______________________________________
You may have to modify it a bit... I did not test it with Word 2000 this
time...
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site: http://www.word.mvps.org