Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #20   Report Post  
Darryl
 
Posts: n/a
Default

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







 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cell formatting [email protected] Microsoft Word Help 1 March 24th 05 11:05 AM
Form Fields lose bold formatting Ellen Microsoft Word Help 0 February 17th 05 09:11 PM
word table cell resize or word table cell size change or word table change cell size [email protected] Tables 0 January 13th 05 09:55 PM
numeric formatting within a cell diane Tables 1 December 15th 04 10:00 AM
Apply Style but keep direct formatting? Stefan Blom New Users 2 November 28th 04 11:30 PM


All times are GMT +1. The time now is 06:59 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"