|
-
Feb 21st, 2004, 03:27 PM
#1
Thread Starter
Fanatic Member
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:
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
Last edited by Pirre001; Feb 21st, 2004 at 04:45 PM.
-
Feb 21st, 2004, 04:28 PM
#2
Hyperactive Member
Re: Why is'nt this working?
Originally posted by Pirre001
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?
maybe try let checkboxes enabled = false?
-
Feb 21st, 2004, 04:34 PM
#3
Move them underneath an opaque control
-
Feb 21st, 2004, 04:37 PM
#4
lol, or try this:
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
[b]DoEvents[/b]
Call keybd_event(VK_SNAPSHOT, 1, 0, 0)
DoEvents
Call keybd_event(VK_SNAPSHOT, 1, KEYEVENTF_KEYUP, 0)
Me.Check1.Visible = True
Me.Check2.Visible = True
Me.Check3.Visible = True
Me.Command1.Visible = True
Me.Command2.Visible = True
End Sub
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Feb 21st, 2004, 04:44 PM
#5
Thread Starter
Fanatic Member
Thanks jemidiah,
Now it works!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|