macro que j'aimerais modifier... mais je ne sais pas où.
le message "le pointage xxx se trouve a cet emplacement xxx"
MsgBox "Votre PDF se trouve à cet emplacement: " & chemsave, vbInformation, "Convertir en PDF"
Private Sub Cmd_PDF_Click()
Dim i As Byte
'boucle sur les éléments de la ListBox
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
feuil = ListBox1.List(i) 'nom de la feuille
Sheets(feuil).Select
ToPdf
End If
Next i
End Sub
Function ToPdf(nomFeuille as string) Dim pdfjob As Object Dim DefaultPrinter Sheets(nomFeuille).Select chemsave = ThisWorkbook.Sheets("MATRICE").Range("A111").Value 'tu peux changer la feuille et la cellule 'If chemsave = "" Then Exit Sub Set pdfjob = CreateObject("PDFCreator.clsPDFCreator") 'NomExcel = ThisWorkbook.Name 'NomPdf = Left(NomExcel, Len(NomExcel) - 4) & ".pdf" With pdfjob If .cstart("/NoProcessingAtStartup") = False Then MsgBox "Can't initialize PDFCreator.", vbCritical + vbOKOnly, "PrtPDFCreator" Exit Sub End If .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutosaveDirectory") = chemsave 'chemin destination .cOption("AutosaveFilename") = feuil & ".pdf" 'nom de la feuille .cOption("AutosaveFormat") = 0 .cClearCache End With ActiveWindow.SelectedSheets.PrintOut From:=1, To:=32766, Copies:=1, ActivePrinter:="PDFCreator" 'on imprime la feuille active 'ThisWorkbook.PrintOut Copies:=1, ActivePrinter:="PDFCreator" Do Until pdfjob.cCountOfPrintjobs = 1 DoEvents Loop pdfjob.cPrinterStop = False Do Until pdfjob.cCountOfPrintjobs = 0 DoEvents Loop With pdfjob .cDefaultprinter = DefaultPrinter .cClearCache .cClose End With Set pdfjob = Nothing 'Dim Ret As Variant 'ouverture du pdf 'Ret = ShellExecute(hwnd, "open", chemsave & To_PDF.ComboBox1.Value & ".pdf", "", vbNullString, 1) ToPdf = "Votre PDF se trouve à cet emplacement: " & chemsave End Function
Private Sub Cmd_PDF_Click() Dim i As Byte Dim msg as string Dim feuil as string 'boucle sur les éléments de la ListBox For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) = True Then feuil = ListBox1.List(i) 'nom de la feuille 'appel de la fonction msg = msg & vbLf & ToPdf(feuil ) End If Next 'Affichage du résultat afficheMessage = msgbox (msg, vbInformation, "Convertir en PDF") End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question