Bonjours a tout le monde !
Dans le cadre d'un projet a l'école, je doit faire un genre de formulaire sur un Userform et l'imprimer en PDF.
Voilà je me casse la tête depuis une petite semaine pour enregistré mon userForm en PDF. Mais il enregistre ma feuille au lieu de mon UserForm ...
Si vous vous avez une solution je prends 🙂
voici le code:
Dim pdfName As String
Application.ScreenUpdating = False
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
DoEvents
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.236)
.BottomMargin = Application.InchesToPoints(0.236)
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
End With
pdfName = ActiveWorkbook.Path & "\Test_de_Conformité.pdf"
ActiveSheet.ExportAsFixedFormat
Type:=xlTypePDF,
Filename:=pdfName,
Quality:=xlQualityStandard,
IncludeDocProperties:=False,
IgnorePrintAreas:=False,
OpenAfterPublish:=True
Application.DisplayAlerts = False
Worksheets(Worksheets.Count).Delete
'Application.SendKeys "{ENTER}"
Unload Me
Application.DisplayAlerts = True
Application.ScreenUpdating = True
	
		
			
		
		
	
				
			Dans le cadre d'un projet a l'école, je doit faire un genre de formulaire sur un Userform et l'imprimer en PDF.
Voilà je me casse la tête depuis une petite semaine pour enregistré mon userForm en PDF. Mais il enregistre ma feuille au lieu de mon UserForm ...
Si vous vous avez une solution je prends 🙂
voici le code:
Dim pdfName As String
Application.ScreenUpdating = False
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
DoEvents
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.236)
.BottomMargin = Application.InchesToPoints(0.236)
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
End With
pdfName = ActiveWorkbook.Path & "\Test_de_Conformité.pdf"
ActiveSheet.ExportAsFixedFormat
Type:=xlTypePDF,
Filename:=pdfName,
Quality:=xlQualityStandard,
IncludeDocProperties:=False,
IgnorePrintAreas:=False,
OpenAfterPublish:=True
Application.DisplayAlerts = False
Worksheets(Worksheets.Count).Delete
'Application.SendKeys "{ENTER}"
Unload Me
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Pièces jointes
			
				Dernière édition: