How can I print the entire form? (to the printer)
Printable View
How can I print the entire form? (to the printer)
VB Code:
Private Sub Command1_Click() Me.PrintForm End Sub
Private Sub PrintButton_Click()
PrintForm
End Sub
ok, works sorta, exept.....
my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?
ok, works sorta, exept.....
my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?
me.printform is good but if you want the user to be able to print more than one copy without having to incessantly press print then use the commondialog.showprinter here is the code that you would use
[Highlight=VB]
Dim BeginPage, EndPage, NumCopies, Orientation, i
CommonDialog1.CancelError = True
On Error GoTo errhandler
CommonDialog1.ShowPrinter
BeginPage = CommonDialog1.FromPage
EndPage = CommonDialog1.ToPage
NumCopies = CommonDialog1.Copies
Orientation = CommonDialog1.Orientation
For i = 1 To NumCopies
Next
me.printform
printer.enddoc
[\vbcode]
:confused:Quote:
Originally posted by meopilite
ok, works sorta, exept.....
my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?
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 cmdPrintForm_Click() Dim lWidth As Long, lHeight As Long Clipboard.Clear Call keybd_event(VK_MENU, 0, 0, 0) Call keybd_event(VK_SNAPSHOT, 0, 0, 0) DoEvents Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0) Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0) Printer.Print If Width > Printer.ScaleWidth Then lWidth = Printer.ScaleWidth lHeight = (Printer.ScaleWidth / Width) * Height Else lWidth = Width lHeight = Height End If Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight Printer.EndDoc End Sub