Results 1 to 5 of 5

Thread: Why is'nt this working? [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2002
    Posts
    665

    Why is'nt this working? [RESOLVED]

    I print my form with this code. Everything works, but the checkboxes and commandbuttons are still visible on print out, even if I set the Visible to False? What's wrong?

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
    2.           ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    3. Private Const VK_MENU As Byte = &H12
    4. Private Const VK_SNAPSHOT As Byte = &H2C
    5. Private Const KEYEVENTF_KEYUP = &H2
    6.  
    7. Private Sub Command3_Click()
    8.  
    9. Clipboard.Clear
    10.  
    11. Me.Check1.Visible = False
    12. Me.Check2.Visible = False
    13. Me.Check3.Visible = False
    14. Me.Command1.Visible = False
    15. Me.Command2.Visible = False
    16.  
    17.  
    18. Call keybd_event(VK_SNAPSHOT, 1, 0, 0)
    19. DoEvents
    20. Call keybd_event(VK_SNAPSHOT, 1, KEYEVENTF_KEYUP, 0)
    21. Printer.Orientation = vbPRORLandscape
    22. Printer.PaperSize = vbPRPSA4
    23. Printer.PrintQuality = vbPRPQHigh
    24.  
    25.     Printer.Print ""
    26.     Printer.Print ""
    27.     Printer.Print ""
    28.     Printer.Print ""
    29.     Printer.Print ""
    30.     Printer.Print ""
    31.     Printer.PaintPicture Clipboard.GetData(), 0, 1000, Printer.width - 1000, Printer.Height - 2800
    32.     Printer.EndDoc
    33.  
    34. Me.Check1.Visible = True
    35. Me.Check2.Visible = True
    36. Me.Check3.Visible = True
    37. Me.Command1.Visible = True
    38. Me.Command2.Visible = True
    39.  
    40. End Sub
    Last edited by Pirre001; Feb 21st, 2004 at 04:45 PM.

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