Inputting decimal numbers cause erroneous results

A

andreas

Dear Experts:

I got a macro that allows me to format the footnote numbers (the ones
at the very bottom of a page) differently from the footnote reference
numbers in the main body text. The macro runs just fine.

There is one thing I would like to get changed/ameliorated.

If the user enters a DECIMAL NUMBER, such as 5,5 or 7,4 (In
Continental EUROPE we use a comma to separate the integer part of a
decimal number from its fractional part) the font size is changed
correctly to that size.

However if the user erroneously enters 5.5 instead of 5,5 it causes
the font size to increase to 55. That is, the user has accidentally
entered a DECIMAL POINT! instead of a comma to separate the integer
part of a decimal number from its fractional part. In CONTINENTAL
EUROPE we use a DECIMAL COMMA instead of a decimal point.

Hence, could somebody help me to re-write this code so that the
entering of a figure with a decimal point (such as 5.5 instead of 5,5)
causes an error and the inputbox re-appears again with the prompt.

Help is much appreciated. Thank you very much in advance.

Best Regards, Andreas



### Code Snippet

bInputValid = False
On Error GoTo Err_Handler1
Set oVar1 = ActiveDocument.Variables("Store1")
Do
FNFS = InputBox("Enter only numeric values between 5 and 12", "Size
of footnote number", oVar1.Value)
If FNFS = vbNullString Then Exit Sub
If IsNumeric(FNFS) Then
If Val(FNFS) >= 5 And Val(FNFS) <= 12 Then
bInputValid = True
End If
End If
Loop Until bInputValid
oVar1.Value = FNFS
 
G

Graham Mayor

Add the line
FNFS = Replace(FNFS, ".", ",")
immediately after the InputBox line
Any entered decimal point will be changed to a comma.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

andreas

Add the line
FNFS = Replace(FNFS, ".", ",")
immediately after the InputBox line
Any entered decimal point will be changed to a comma.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>













- Show quoted text -

Hi Graham,

great. It is working. Thank you very much for your terrific help.
Regards, Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top