Corriger Macro PRINT PREVIEW et PRINT

MisterT

XLDnaute Occasionnel
Bonjour à chacun, :)

Avec mon peu de connaissance VBA j'ai amassé ici et là des infos pour créer une Macro pour faire un Print Preview et un Print d'une zone définie incluant le PAGE SETUP.

Le Print Preview et Print fonctionnent mais ne tiennent pas compte du PAGE SETUP que je demande.

Est-ce que quelqu'un accepterais de regarder le code et corriger l'erreur, ce serait très apprécié ?

Code:
Sub PrintPreview()
Application.ScreenUpdating = False
Dim Answer As String

Sheets("WELCOME").Select

PRINT_PAGE_SETUP
Range("$A$1:$M$38").Select
ActiveSheet.PrintPreview
Application.ScreenUpdating = True
Answer = MsgBox(Prompt:="Do you want to Print the Page?", _
Title:="Print Confirmation", _
Buttons:=vbYesNo)

If Answer <> vbYes Then
Range("A1").Select
Exit Sub
End If
Application.ScreenUpdating = False

ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1
Range("A1").Select
Application.ScreenUpdating = True
End Sub
-------------------------------------------------
Sub RapidPrint()
Application.ScreenUpdating = False
Sheets("WELCOME").Select
Range("$A$1:$M$38").Select
PRINT_PAGE_SETUP
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1
Range("A1").Select
Application.ScreenUpdating = True
End Sub
-------------------------------------------------
Sub PRINT_PAGE_SETUP()
With ActiveSheet.PageSetup
.PrintArea = "$A$1:$M$38"
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.BlackAndWhite = False
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
End With
End Sub

Merci et bonne journée !
MisterT :)
 

Discussions similaires

Statistiques des forums

Discussions
312 369
Messages
2 087 675
Membres
103 634
dernier inscrit
mariobroz