{Word for Mac} Runtime Error 5148 The number must be between {b} and {b}

Discussion in 'Mac Programming' started by bmichelle510, Oct 17, 2012.

  1. bmichelle510 macrumors newbie

    Joined:
    Oct 17, 2012
    #1
    Hello,
    I am working in Word for Mac on a template that gets information from a userform. The data is entered and according to what is entered a string is assigned to a variable. I then want the string to appear in the document at the bookmark. When I run the application I get the RuntimeError 5148 The number must be between {b} and {b}. I would really appreciate any help. Thank You.

    Code:
    Private Sub cmdbtnSubmit_Click()
    Select Case ""
    Case Me.txtbxCauseCourt.Value
    MsgBox "Please fill-in the court."
    Me.txtbxCauseCourt.SetFocus
    Exit Sub
    Case Me.txtbxCauseYrMonth.Value
    MsgBox "Please fill-in the year and month."
    Me.txtbxCauseYrMonth.SetFocus
    Exit Sub
    Case Me.txtbxCauseType.Value
    MsgBox "Please fill-in type."
    Me.txtbxCauseType.SetFocus
    Exit Sub
    Case Me.txtbxCauseCase.Value
    MsgBox "Please fill-in case number."
    Me.txtbxCauseCase.SetFocus
    Exit Sub
    Case Me.txtbxFirstName.Value
    MsgBox "Please fill-in client's first name."
    Me.txtbxFirstName.SetFocus
    Exit Sub
    Case Me.txtbxLastName.Value
    MsgBox "Please fill-in client's last name."
    Me.txtbxLastName.SetFocus
    Exit Sub
    End Select
    
    If Me.txtbxCauseCourt.Value = "45D09" Then
    strCourtName = "LAKE COUNTY SUPERIOR COURT"
    strCourtDivision = "DIVISION III"
    strCourtCityAddress = "CROWN POINT, INDIANA"
    End If
    
    
    Dim BMRange As Range
    Set BMRange = ActiveDocument.Bookmarks("txtCourtName").Range
    BMRange.Text = strCourtName
    ActiveDocument.Bookmarks.Add "txtCourtName", BMRange
    
    
    End Sub
    [CODE]
     
  2. bmichelle510 thread starter macrumors newbie

    Joined:
    Oct 17, 2012

Share This Page