Results 1 to 2 of 2

Thread: Help printing a form

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    3

    Help printing a form

    I have this form that is too big to print on a page. Is there a way to fit a form onto a page without resizing the form itself?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Help printing a form

    Try this
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte, _
    4. ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    5.  
    6. Private Const VK_MENU As Byte = &H12
    7. Private Const VK_SNAPSHOT As Byte = &H2C
    8. Private Const KEYEVENTF_KEYUP = &H2
    9.  
    10. Private Sub cmdPrintScreen_Click()
    11. Screen.MousePointer = vbHourglass
    12. Dim lWidth As Long, lHeight As Long
    13.     Clipboard.Clear
    14.     Call keybd_event(VK_MENU, 0, 0, 0)
    15.     Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
    16.     DoEvents
    17.     Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
    18.     Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)
    19.     Printer.Print
    20.     If Width > Printer.ScaleWidth Then
    21.         lWidth = Printer.ScaleWidth
    22.         lHeight = (Printer.ScaleWidth / Width) * Height
    23.     Else
    24.         lWidth = Width
    25.         lHeight = Height
    26.     End If
    27.     Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight
    28.     Printer.EndDoc
    29. Screen.MousePointer = vbDefault
    30. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width