|
 |

Les Impressions
Imprime chaque fiche (fiche =plage G1:K18) des feuilles(5 à 42) du classeur
Sub ImprimFiche() Msg = "Voulez-vous vraiment imprimer TOUTES les fiches ?"
Style = vbYesNo + vbCritical + vbDefaultButton1 Title = "IMPRESSION DES FICHES"
Réponse = MsgBox(Msg, Style, Title) If Réponse = vbYes Then GoTo continu Else Exit Sub End If continu: Dim mafeuille As Object
Application.ScreenUpdating = False Set monTab = Worksheets(Array(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, _ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42)) For Each mafeuille In monTab
mafeuille.Select ActiveSheet.PageSetup.PrintArea = "$G$1:$K$18"
ActiveWindow.SelectedSheets.PrintOut Copies:=1 Next End Sub
Imprime un nombre définit de formulaires et incrémente le numéro du formulaire.
Sub ImprimFormulaire() Dim CellPara
Range("A2") = Application.InputBox(prompt:="Taper le nombre de copies que vous désirez.", Type:=1)
For CellPara = 1 To Range("A2") Range("E13").Value = Range("E13").Value + 1
ActiveSheet.PageSetup.PrintArea = "$A$5:$I$24" ActiveWindow.SelectedSheets.PrintOut Copies:=1
Next End Sub
Lance une impression à l'heure donnée.
Sub ProgrammeLaMacroTime()
' lance MacroImpression à 10h25 heures
Application.OnTime TimeValue("10:25:00"), "MacroImpression", , True
End Sub
Sub MacroImpression()
'cette macro imprime la feuille Feuil1
ThisWorkbook.Sheets("Feuil1").PrintOut
End Sub
Défini une zone d'impression et un titre.
Inscriver un titre dans la cellule A1
et taper quelques valeurs dans la zone A10:G15
Sub ImpZoneEtTitle()
With Worksheets("Feuil1").PageSetup
.CenterHorizontally = True
.PrintArea = "$A$10:$G$15"
.PrintTitleRows = ("$A$1:$A$2")
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Worksheets("Feuil1").PrintOut
End Sub
Comment récupérer l'adresse de la zone d'impression?
Sub Recupzone()
Set zoneIMP = Range(ActiveSheet.PageSetup.PrintArea)
MsgBox zoneIMP.Address()
End Sub
Comment créer un document excel* en PDF sous Windows et ceci GRATUITEMENT?
Voir la page complète "PDF"
Comment interdire l'impression d'un classeur?
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
MsgBox ("Vous n'avez pas l'autorisation d'imprimer ce classeur")
End Sub
Comment connaître le nombre de pages à imprimer?
Sub Nbpages()
NbdePages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
End Sub
Ouvre un fichier et l'imprime automatiquement
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal _
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As _
String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Sub Imprim()
Dim oFile As String
Application.ScreenUpdating = False
'imprime le fichier test.txt
oFile = "C:\ajeter\test.txt"
ShellExecute hwnd, "print", oFile, vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
[top]
|