none
how to change datatype in Word template using vba? RRS feed

  • Question

  • I am using the following to check for existence of a bookmark in a template. How can I now

    1) change the datatype of bookmark ("RGFBondedAcres") from text to Number using VBA

    2) Is there a way to check to see if the bookmark is null?

     If ActiveDocument.Bookmarks.Exists("RGFBondedAcres") = True Then
         OraDatabase.Parameters.Add "RGFBondedAcres", ActiveDocument.FormFields("RGFBondedAcres").Result, dbParamInput
         OraDatabase.Parameters("RGFBondedAcres").ServerType = 1

    rest of code

     End If

    Appreciate the help

    Jim


    jim neal

    Thursday, June 6, 2013 12:00 AM

Answers

  • oFFld("RGFBondedAcres").TextInput.EditType wdNumberText

    (The form must be unprotected for that, too)


    Peter Jamieson

    • Marked as answer by JamesLNeal Saturday, June 8, 2013 3:16 AM
    Thursday, June 6, 2013 8:16 AM

All replies

  • ok, the following will test whether the bookmark is blank. Does anyone have any suggestions on changing the data type from text to number?

    Dim oFFld As FormFields
    Dim oBkMrk As Bookmarks
    Dim oBkMrkRng As Word.Range
      Set oFFld = ActiveDocument.FormFields
      Set oBkMrk = ActiveDocument.Bookmarks
    '  ActiveDocument.Unprotect
      If oFFld("RGFBondedAcres").Result = "" Then
      MsgBox ("Worked")
      Else
      MsgBox ("back to the drawing board")
      End If


    jim neal

    Thursday, June 6, 2013 2:42 AM
  • oFFld("RGFBondedAcres").TextInput.EditType wdNumberText

    (The form must be unprotected for that, too)


    Peter Jamieson

    • Marked as answer by JamesLNeal Saturday, June 8, 2013 3:16 AM
    Thursday, June 6, 2013 8:16 AM