Estimados tengo un formulario en el cual envio todos los datos quje quiero imprimir desde un data grid con un chek
pero al imprimir solo me muestra 3 impresiones y no todas :)
este es el codigo
Código vb:
Ver originalPublic oRs As New ADODB.Recordset
'Public Opcion As String
Private Sub cmdCancelar_Click()
Unload Me
End Sub
Private Sub cmdImprimir_Click()
On Error GoTo SALTO_ERROR
'
' Dim oo As Object
' Dim Ruta As String
' Dim strSQL As String
' Dim Imprimir As String
' Dim sRutaLogo As String
Dim oo As Object
Dim Ruta As String
Dim strSQL As String
Dim Imprimir As String
Dim sRutaLogo As String
Set oo = CreateObject("excel.application")
strSQL = "SELECT Ruta_Logo = ISNULL(Ruta_Logo, '') From SEGURIDAD..SEG_EMPRESAS WHERE Cod_Empresa = '" & vemp & "'"
sRutaLogo = DevuelveCampo(strSQL, cConnect)
If MsgBox("Desea imprimir directamente...", vbYesNo + vbQuestion, "Impresion") = vbYes Then
Imprimir = "1"
Else
Imprimir = "0"
End If
oRs.MoveFirst
Do While Not oRs.EOF
If oRs("CHK") = True Then
If CheckListaMaterial.Value = Checked Then
Ruta = vRuta & "\RptFichaTecnica.XLT"
Set oo = CreateObject("excel.application")
oo.Workbooks.Open Ruta
If Imprimir = 0 Then
oo.Visible = True
End If
oo.DisplayAlerts = False
oo.Run "Reporte", 1, "001", oRs("cod_ordpro"), vemp, Left(oRs("ESTILOP"), 5), Left(oRs("VERSION"), 2), cConnect, sRutaLogo, Imprimir
Set oo = Nothing
End If
If CheckHojaConstruccion.Value = Checked Then
Ruta = vRuta & "\RptFichaTecnicaPrueba.XLT"
Set oo = CreateObject("excel.application")
oo.Workbooks.Open Ruta
oo.Visible = True
oo.DisplayAlerts = False
oo.Run "Reporte", 1, "001", oRs("cod_ordpro"), vemp, Left(oRs("ESTILOP"), 5), Left(oRs("VERSION"), 2), cConnect, sRutaLogo, Imprimir
Set oo = Nothing
End If
If CheckHojaArtes.Value = Checked Then
Ruta = vRuta & "\RptFichaTecnicaArtes.XLT"
Set oo = CreateObject("excel.application")
oo.Workbooks.Open Ruta
oo.Visible = True
oo.DisplayAlerts = False
oo.Run "Reporte", 1, "001", oRs("cod_ordpro"), vemp, Left(oRs("ESTILOP"), 5), Left(oRs("VERSION"), 2), cConnect, sRutaLogo, Imprimir
Set oo = Nothing
End If
End If
oRs.MoveNext
Loop
Exit Sub
SALTO_ERROR:
MsgBox Err.Description, vbCritical, Me.Caption
End Sub