View Single Post
 
Old 08-31-2021, 09:56 PM
gorkac gorkac is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2021
Posts: 62
gorkac is on a distinguished road
Default

Hi Mr. Mayor. I need a last favor.
In the same document, there are parts to fill in with the same bookmarks, but Word does not allow repeating the name of the bookmarks "termino", and so on. What lines can I add so that I fill in a new bookmark named "termino2", for example, what is filled in the marker "termino"?

Quote:
Originally Posted by gmayor View Post
You probably need something like the following, but if there are lots of these values as seems to be the case you would be better putting the codes and their values in an Excel worksheet and reading them from the worksheet.

Code:
Private Sub CommandButton2_Click()
Dim sVia As String
Dim lPK As String
    sVia = ComboVia.Text
    lPK = textPK.Value
    Select Case sVia
        Case Is = "A-68"
            If lPK > 81 And lPK < 85 Then
                Rellenar "termino", "Castejon"
                Rellenar "partido", "Tudela"
            End If
            If lPK > 84 And lPK < 99 Then
                Rellenar "termino", "Corella"
                Rellenar "partido", "Estella"
            End If
            If lPK > 98 And lPK < 113 Then
                Rellenar "termino", "Fontellas"
                Rellenar "partido", "Tafalla"
            End If
        Case Is = "NA-3010"
            If lPK > 20 And lPK < 25 Then
                Rellenar "termino", "Cortes"
                Rellenar "partido", "Tudela"
            End If
            If lPK > 24 And lPK < 35 Then
                Rellenar "termino", "Ribaforada"
                Rellenar "partido", "Tafalla"
            End If
            If lPK > 34 And lPK < 44 Then
                Rellenar "termino", "Novillas"
                Rellenar "partido", "Estella"
            End If
    End Select
lbl_Exit:
    Exit Sub
End Sub
Reply With Quote