Saludos Profesor Sergio, de ante mano gracias por responder, realice lo que me sugirió coloque el código donde me indicó, sin embargo me sigue arrojando el mismo error.
' Restaurar formato de fuente
With wsHistorico.Rows("2:2").Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
' Incrementar automáticamente el número de recibo
wsRecibo.Range("J2").Value = wsRecibo.Range("J2").Value + 1
'Corrección de Error en impresión
Application.Wait (Now + TimeValue("0:00:01"))
' Imprimir
wsRecibo.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Por
dorgelis, · publicado
Hola amig@s
Tengo un problema que no doy con el.
En el códigos siguiente, el Setfocus no “funciona”…
¿Qué estoy haciendo mal?...
De repente estoy trancado en alguna tontería pero ya “no veo” ja!.
Me podrias ayudar?
Gracias de antemano.
Private Sub cmdAceptar_click()
Application.ScreenUpdating = False
If Trim(Me.txt_fecha) = Empty Then
Me.txt_fecha.BackColor = &HC0C0FF
MsgBox "Debe ingresar la fecha de la operación", , "CAMPO VACIO"
Me.txt_fecha.SetFocus
Me.txt_fecha.SelStart = 0
Exit Sub
ElseIf Trim(Me.txt_Descripcion) = "" Then
Me.txt_Descripcion.BackColor = &HC0C0FF
MsgBox "Detalle la operacion", , "CAMPO VACIO"
Me.txt_Descripcion.SetFocus
Me.txt_Descripcion.SelStart = 0
Exit Sub
ElseIf me.cbx_Naturaleza = "" Then
Me.cbx_Naturaleza.BackColor = &HC0C0FF
MsgBox "Seleccione Naturaleza de la operación", , "CAMPO VACIO"
Me.cbx_Naturaleza.SetFocus
Me.cbx_Naturaleza.SelStart = 0
Exit Sub
ElseIf Me.cbx_Operacion = "" Then
Me.cbx_Operacion.BackColor = &HC0C0FF
MsgBox "Seleccione tipo de Operacion", , "CAMPO VACIO"
Me.cbx_Operacion.SetFocus
Me.cbx_Operacion.SelStart = 0
Exit Sub
ElseIf Me.cbx_Fondo = "" Then
Me.cbx_Fondo.BackColor = &HC0C0FF
MsgBox "Seleccione Fondo afectado", , "CAMPO VACIO"
Me.cbx_Fondo.SetFocus
Me.cbx_Fondo.SelStart = 0
Exit Sub
ElseIf Me.txt_Importe = "" Then
Me.txt_Importe.BackColor = &HC0C0FF
MsgBox "Ingrese el Importe", , "CAMPO VACIO"
Me.txt_Importe.SetFocus
Me.txt_Importe.SelStart = 0
Exit Sub
ElseIf Not IsDate(Me.txt_fecha.Value) Then 'verifica que sea una fecha valida
Me.txt_fecha.BackColor = &HC0C0FF
MsgBox "Fecha invalida.", vbCritical, " ERROR !"
Me.txt_fecha.SetFocus
Me.txt_fecha.SelStart = 0
Exit Sub
ElseIf Me.cbx_Naturaleza.Text = "Egresos" And Me.txt_Importe.Value > 0 Then
Me.txt_Importe.BackColor = &HC0C0FF
MsgBox "Debe ser importe negativo", vbCritical, " ERROR !"
Me.txt_Importe.SetFocus
Me.txt_Importe.SelStart = 0
Exit Sub
ElseIf Me.cbx_Naturaleza.Text = "Ingresos" And Me.txt_Importe.Value < 0 Then
Me.txt_Importe.BackColor = &HC0C0FF
MsgBox "Debe ser importe positivo", vbCritical, " ERROR !"
Me.txt_Importe.SetFocus
Me.txt_Importe.SelStart = 0
Exit Sub
End If