View Single Post
 
Old 08-22-2021, 04:45 AM
gorkac gorkac is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2021
Posts: 62
gorkac is on a distinguished road
Default

Aaargh...
Two problems appear.
1.- The bookmarks "termino" and "partido" are not filled.

Code:
Case Is = "AP-15"
Rellenar "denominacion", "Autopista de Navarra"
                If lPK >= 0 And lPK <= 1.225 Then
                        Rellenar "termino", "Corella"
                        Rellenar "partido", "Tudela"
                End If
Here the remaining code:
Code:
Public Sub Rellenar(strNombreMarcador As String, strValor As String)
'Gorka Cuairan. Función que rellena marcadores
Dim Rng As Range
    With ActiveDocument
        On Error GoTo lbl_Exit
        Set Rng = .Bookmarks(strNombreMarcador).Range
        Rng.Text = strValor
        Rng.Bookmarks.Add strNombreMarcador
    End With
lbl_Exit:
    Set Rng = Nothing
    Exit Sub
End Sub

Private Sub Userform_Activate()          'FORMULARIO, CARGA VIA
Call Carreteras.CargarCarreteras(cbovia)
End Sub

Public Sub CommandButton1_Click()        'BOTON Aceptar'
' Uso la funcion Rellenar
   Rellenar "via", cbovia.Text           ' Asigno valor introducido en combo cbovia
   Rellenar "kilometro", txtpk.Text   ' Asigno valor en textbox kilometro
Dim sVia As String
Dim lPK As String
    sVia = cbovia.Text
    lPK = txtpk.Value
lbl_Exit:
    Exit Sub
End Sub
2.- The message does not show it if I enter a higher value:
Code:
 If lPK > 112.151 Then
MsgBox "Introduce un punto kilometrico menor que 112,151"
   End If
Reply With Quote