-
{word for mac} Runtime error 5148 The number must be between {b} and {b}
Hello,
I am working in Word for Mac. There is a user form that collects the data. Then the data needs to be inserted into the document. Some of the data has to be verified first and strings are assigned to variables. When I debug it takes me to the first line in the "with" statement. When I run the same program on a PC I get a different error. It says the bookmark can not be deleted and takes me to the same line of code. I would really appreciate some help.
Thank You
[VBA]Option Explicit
Dim strCourtName As String
Dim strCourtDivision As String
Dim strCourtStreetAddress As String
Dim strCourtCityAddress As String
Dim strProsecutorStreetAddress As String
Dim strProsecutorCityAddress As String
Private Sub CmdbtCancel_Click()
Me.Hide
End Sub
Private Sub CmdbtnSubmit_Click()
If TxtbxCauseCourt.Value = "45D07" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "DIVISION I"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45D08" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "DIVISION II"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45D09" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "DIVISION III"
End If
If TxtbxCauseCourt.Value = "45D12" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "DIVISION IV"
strCourtCityAddress = "HAMMOND, INDIANA"
End If
If TxtbxCauseCourt.Value = "45G01" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "ROOM NUMBER ONE"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45G02" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "ROOM NUMBER TWO"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45G03" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "ROOM NUMBER THREE"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45G04" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "ROOM NUMBER FOUR"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45G09" Then
strCourtName = "LAKE SUPERIOR COURT"
strCourtDivision = "DIVISION III"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H01" Then
strCourtName = "CROWN POINT CITY COURT"
strCourtCityAddress = "CROWN POINT, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H02" Then
strCourtName = "EAST CHICAGO CITY COURT"
strCourtCityAddress = "EAST CHICAGO, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H04" Then
strCourtName = "HAMMOND CITY COURT"
strCourtCityAddress = "HAMMOND, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H05" Then
strCourtName = "HOBART CITY COURT"
strCourtCityAddress = "HOBART, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H06" Then
strCourtName = "LAKE STATION CITY COURT"
strCourtCityAddress = "LAKE STATION, INDIANA"
End If
If TxtbxCauseCourt.Value = "45H07" Then
strCourtName = "WHITING CITY COURT"
strCourtCityAddress = "WHITING, INDIANA"
End If
If TxtbxCauseCourt.Value = "45I02" Then
strCourtName = "SCHERERVILLE TOWN COURT"
strCourtCityAddress = "SCHERERVILLE, INDIANA"
End If
If TxtbxCauseCourt.Value = "45I03" Then
strCourtName = "LOWELL TOWN COURT"
strCourtCityAddress = "LOWELL, INDIANA"
End If
With ActiveDocument
.Bookmarks("bmCourtName").Range.Text = strCourtName
.Bookmarks("bmCourtDivision").Range.Text = strCourtDivision
.Bookmarks("bmCourtCityAddress").Range.Text = strCourtCityAddress
.Bookmarks("bmFirstName").Range.Text = TxtbxFirstName.Value
.Bookmarks("bmLastName").Range.Text = TxtbxLastName.Value
.Bookmarks("bmCauseCourt").Range.Text = TxtbxCauseCourt.Value
.Bookmarks("bmCauseYrMth").Range.Text = TxtbxCauseYrMth.Value
.Bookmarks("bmCauseType").Range.Text = TxtbxCauseType.Value
.Bookmarks("bmCauseNo").Range.Text = TxtbxCauseNo.Value
End With
If cbInitiating.Value = True Then
ActiveDocument.Bookmarks("bmInitiating").Range.Text = "__X__"
End If
If cbResponding.Value = True Then
ActiveDocument.Bookmarks("bmResponding").Range.Text = "__X__"
End If
If cbIntervening.Value = True Then
ActiveDocument.Bookmarks("bmIntervening").Range.Text = "__X__"
End If
If cbOtherPartiesYes.Value = True Then
ActiveDocument.Bookmarks("bmOtherPartiesYes").Range.Text = "__X__"
End If
If cbOtherPartiesNo.Value = True Then
ActiveDocument.Bookmarks("bmOtherPartiesYes").Range.Text = "__X__"
End If
If cbSupportIssuesYes.Value = True Then
ActiveDocument.Bookmarks("bmSupportIssuesYes").Range.Text = "__X__"
End If
If cbSupportIssuesNo.Value = True Then
ActiveDocument.Bookmarks("bmSupportIssuesNo").Range.Text = "__X__"
End If
If cbRelatedCasesYes.Value = True Then
ActiveDocument.Bookmarks("bmRelatedCasesYes").Range.Text = "__X__"
End If
If cbRelatedCasesNo.Value = True Then
ActiveDocument.Bookmarks("bmRelatedCasesNo").Range.Text = "__X__"
End If
If cbOtherPartiesServedYes.Value = True Then
ActiveDocument.Bookmarks("bmPartiesServedYes").Range.Text = "__X__"
End If
If cbOtherPartiesServedNo.Value = True Then
ActiveDocument.Bookmarks("bmPartiesServedNo").Range.Text = "__X__"
End If
Unload Me
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules