Microsoft Word - Text Form Feed - Number with variable decimal places RRS feed

  • Question

  • Hi,

    I have a field in my form that always consists of 5 numbers and a comma.

    The comma however, can be at any position.
    1,2345 is possible, but 123,45 is also possible.

    ,12345 and 12345, are not possible.

    Does anyone know whether this is possible and how to get it done?

    Thanks in advance

    Friday, June 1, 2018 2:34 PM

All replies

  • Hi MaarBru,

    Try to insert a new Text Form field, type numbers in the field, check if you can type ,12345.

    Also right-click the Text Form field, select Properties, check your property settings for this field and share the information here for more information. If you cannot share picture here, upload it via OneDrive and share the picture link here as a workaround.

    Best Regards,
    Winnie Liang

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, June 4, 2018 9:09 AM
  • Winnie,

    What is required to verify my account?
    I cannot share a picture or link, until it is able to verify my account. It keeps coming with a pop-up.

    I am already logged in, so what more is required?


    Monday, June 4, 2018 10:22 AM
  • You can achieve the desired result by attaching a suitable on-exit macro to the formfield. For example:

    Dim StrNm As String
    Sub StrChk()
    With ActiveDocument.FormFields("Text1")
      If (Left(.Result, 1) = ",") Or (Right(.Result, 1) = ",") Or (InStr(.Result, ",") = 0) Then
        StrNm = .Name
        MsgBox "Invalid Input", vbInformation
        Application.OnTime When:=Now + 1 / 8640000, Name:="ReselectFmFld"
      End If
    End With
    End Sub
    Sub ReselectFmFld()
    End Sub

    where 'Text1' is your formfield's internal bookmark name. With the above code, your formfield input is validated when it is exited and, if the data are invalid the user is notified and the formfield re-selected.

    Paul Edstein
    [MS MVP - Word]

    Tuesday, June 5, 2018 4:31 AM