Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

bmichelle510

Programmer
Oct 17, 2012
1
US
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]
 
The code you posted does not appear to be capable of generating RuntimeError 5148.

Please post your query in the VBA forum ( including advice on what code line gets highlighted when the error occurs and what the two values are.
PS: When posting code, please use the code tag button - it reduces the likelihood of display errors.

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top