Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
I created a brand new document with a table (inserted from the forms toolbar) that had three columns. first, I put the insertion point into column 1 row 1. Then selected text form field from the forms toolbar. I then right clicked, chose properties and set the a field type to number. Text format to 0.00%. Selected divide100 as the exit macro. Under the field settings group box I set the bookmark to value1. Clicked OK. Clicked form protect button on forms toolbar. Then to test, put insertion point in column1 row 1 and typed 1.23 then pressed the tab key. Immediately the type mis-match error 13 pops up. press debug on the error dialog box and the debugger says the offending is: myValue = CSng(Left(.Text, Len(.Text) - 1)) what am I doing wrong ? thanks, Darryl "Jean-Guy Marcil" wrote in message ... Darryl was telling us: Darryl nous racontait que : Well, I changed Value1 to my field name. I have the field set as number, format 0.00%, macro on exit is divide100. When I run it, I get a type mismatch error. Looking at the macro, I'm not sure why ? Form field is type number. Is the macro assuming the field is text ? I created a protected form with a text field set to number with the 0.00% format, then I protected the form. My macro works. I just checked again, and it worked. So we are doing things differently. Describe how you created the field (and gave it a name) where the user enters the value and the document itself (how is it protected, what does it contain). -- Salut! _______________________________________ Jean-Guy Marcil - Word MVP ISTOO Word MVP site: http://www.word.mvps.org |
#2
|
|||
|
|||
Leave the formfield set as a text formfield and run a macro on exit from the
formfield that contains the following code: With ActiveDocument.FormFields("Text1") .result = Format(.result / 1000, "0.00%") End With replace "Text1" with the bookmark name assigned to the formfield. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Darryl" wrote in message ... I created a brand new document with a table (inserted from the forms toolbar) that had three columns. first, I put the insertion point into column 1 row 1. Then selected text form field from the forms toolbar. I then right clicked, chose properties and set the a field type to number. Text format to 0.00%. Selected divide100 as the exit macro. Under the field settings group box I set the bookmark to value1. Clicked OK. Clicked form protect button on forms toolbar. Then to test, put insertion point in column1 row 1 and typed 1.23 then pressed the tab key. Immediately the type mis-match error 13 pops up. press debug on the error dialog box and the debugger says the offending is: myValue = CSng(Left(.Text, Len(.Text) - 1)) what am I doing wrong ? thanks, Darryl "Jean-Guy Marcil" wrote in message ... Darryl was telling us: Darryl nous racontait que : Well, I changed Value1 to my field name. I have the field set as number, format 0.00%, macro on exit is divide100. When I run it, I get a type mismatch error. Looking at the macro, I'm not sure why ? Form field is type number. Is the macro assuming the field is text ? I created a protected form with a text field set to number with the 0.00% format, then I protected the form. My macro works. I just checked again, and it worked. So we are doing things differently. Describe how you created the field (and gave it a name) where the user enters the value and the document itself (how is it protected, what does it contain). -- Salut! _______________________________________ Jean-Guy Marcil - Word MVP ISTOO Word MVP site: http://www.word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cell formatting | Microsoft Word Help | |||
Form Fields lose bold formatting | Microsoft Word Help | |||
word table cell resize or word table cell size change or word table change cell size | Tables | |||
numeric formatting within a cell | Tables | |||
Apply Style but keep direct formatting? | New Users |