nuno
Mensagens : 62 Data de inscrição : 27/02/2013
| Assunto: Impresão de Form Qui Ago 22, 2013 2:36 pm | |
| Bom dia
Como sempre necessitava da vossa ajuda:
Tenho uma tela de cadastro onde existe um botão de Printform. Acontece que imprime-me o formulário numa folha mas na vertical. Queria que sempre que carregasse ele direcionasse a impressora pré definida a imprimir na horizontal e já agora que ajustasse o tamanho que eu definir.
Como posso fazer isso?
Como este form é para ser utlizado em vários pcs teria que configurar todas a s impressoras e isso não é pratico!
Agradecia a vossa ajuda.
Obrigado | |
|
alexandrevba
Mensagens : 1820 Data de inscrição : 13/07/2011 Localização : Serra - ES
| Assunto: Re: Impresão de Form Sáb Ago 24, 2013 8:05 pm | |
| Boa tarde!!! Leia: http://social.msdn.microsoft.com/Forums/pt-BR/def468a2-a317-496e-85a1-ab37bd449264/printing-vba-userform-as-landscape - Código:
-
Option Explicit Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Const VK_SNAPSHOT = 44 Const VK_LMENU = 164 Const KEYEVENTF_KEYUP = 2 Const KEYEVENTF_EXTENDEDKEY = 1 Private Sub CommandButton1_Click() DoEvents 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 Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, _ DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveSheet.PageSetup.Orientation = xlLandscape With ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = "" End With ActiveSheet.PageSetup.PrintArea = "" With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.75) .RightMargin = Application.InchesToPoints(0.75) .TopMargin = Application.InchesToPoints(1) .BottomMargin = Application.InchesToPoints(1) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .CenterHorizontally = True .CenterVertically = True .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperA4 .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 End With ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False Application.ScreenUpdating = True End Sub
| |
|
nuno
Mensagens : 62 Data de inscrição : 27/02/2013
| Assunto: impressao-Resolvido Dom Set 01, 2013 11:56 pm | |
| Obrigado pela ajuda!!! Resolvido | |
|
alexandrevba
Mensagens : 1820 Data de inscrição : 13/07/2011 Localização : Serra - ES
| Assunto: Re: Impresão de Form Seg Set 02, 2013 12:59 am | |
| Boa noite!!
Obrigado pelo retorno, que bom que resolveu seu problema:lol:
Att | |
|
Conteúdo patrocinado
| Assunto: Re: Impresão de Form | |
| |
|