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:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const VK_MENU As Byte = &H12 Private Const VK_SNAPSHOT As Byte = &H2C Private Const KEYEVENTF_KEYUP = &H2 Private Sub Command3_Click() Clipboard.Clear Me.Check1.Visible = False Me.Check2.Visible = False Me.Check3.Visible = False Me.Command1.Visible = False Me.Command2.Visible = False Call keybd_event(VK_SNAPSHOT, 1, 0, 0) DoEvents Call keybd_event(VK_SNAPSHOT, 1, KEYEVENTF_KEYUP, 0) Printer.Orientation = vbPRORLandscape Printer.PaperSize = vbPRPSA4 Printer.PrintQuality = vbPRPQHigh Printer.Print "" Printer.Print "" Printer.Print "" Printer.Print "" Printer.Print "" Printer.Print "" Printer.PaintPicture Clipboard.GetData(), 0, 1000, Printer.width - 1000, Printer.Height - 2800 Printer.EndDoc Me.Check1.Visible = True Me.Check2.Visible = True Me.Check3.Visible = True Me.Command1.Visible = True Me.Command2.Visible = True End Sub




Reply With Quote