Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Rapport Excel à rapport PDF

Aucune réponse
Avatar
mclauren0
Bonjour,

J'ai un rapport en Excel que j'ai construit à partir d'une base de donnée est-il possible d'élaborer ce même rapport en PDF directement comme j'ai pu le faire en Excel depuis VB6.
Je vous serais gré si vous pouvez m'aider sur ce thème.
Merci d'avance, je vous passe une partie de mon code pour que vous voyer de quoi il en est.

Private Sub TxtSerial_KeyPress(KeyAscii As Integer)

Dim book As New Excel.Workbook
Dim Exc As New Excel.Application

Dim serial As String
Dim Fila As Long
Dim Fila1 As Long

If KeyAscii = 13 Then
serial = Trim(UCase(TxtSerial.Text))


With Exc
.Workbooks.Add
.Visible = True
'.Cells(1, 1) = "Serial"
.Cells(1, 1) = "Operacion"
.Cells(1, 2) = "Actividad"
.Cells(1, 3) = "Sub-Actividad"
.Cells(1, 4) = "Rutina"
.Cells(1, 5) = "Status"
.Cells(1, 6) = "Usuario"
.Cells(1, 7) = "Fecha"
.Cells(1, 8) = "Tiempo"
FrmPpal.Rs.Open "SELECT rtrim(ltrim(op.data1)), rtrim(ltrim(ac.data2)), rtrim(ltrim(su.data4)), rtrim(ltrim(r.data3)),rtrim(ltrim(reg.valor)),rtrim(ltrim(u.name)),reg.fecha, reg.tiempo FROM Operation AS op INNER JOIN Activity AS ac ON op.id_op = ac.id_op INNER JOIN subactivity AS su ON ac.id_act = su.id_act INNER JOIN Routine AS r ON su.id_subact = r.id_subact inner JOIN registro AS reg ON r.id_rout=reg.id_rout left join usuarios u on reg.id_user=u.id_user WHERE reg.serial='" & serial & "'", FrmPpal.Con
.Cells(2, 1).CopyFromRecordset FrmPpal.Rs
FrmPpal.Rs.Close

Fila = 2
While .Cells(Fila, 1) <> ""
Fila = Fila + 1
DoEvents
Wend
Fila = Fila - 1
For Fila1 = Fila To 2 Step -1

If Trim(.Cells(Fila1 - 1, 1)) = Trim(.Cells(Fila1, 1)) Then
.Cells(Fila1, 1) = ""
End If
If Trim(.Cells(Fila1 - 1, 2)) = Trim(.Cells(Fila1, 2)) Then
.Cells(Fila1, 2) = ""
End If
If Trim(.Cells(Fila1 - 1, 3)) = Trim(Cells(Fila1, 3)) Then
.Cells(Fila1, 3) = ""
End If

.Cells(Fila1, 1).Select
DoEvents

End With


End If
Unload Me
End Sub

Réponses