I thought this would be a easy search, but came up empty.
I have a form with a print button that I would like to get the Print Prompt, so I can select what printer and how many copies.
I thought this would be a easy search, but came up empty.
I have a form with a print button that I would like to get the Print Prompt, so I can select what printer and how many copies.
Emoncada i think its something like this!
[VBA]Application.Dialogs(xlDialogPrint).Show [/VBA]
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
That prints out the spreadsheet, but I want it for the UserForm.
The userform has a print for method like:
UserForm1.PrintForm
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Yes but just prints the userform once I need it to prompt the user how many copies wanted.
I'm gonna throw this out there Em....why would you want to print a form?
Why not format a sheet for printing and input your data to a for print sheet.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
This may be a sledgehammer to crack a nut, based on this KB item
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
This is apacking slip and needs to print in that form for the package then data is seperated on worksheet. Originally had it on a worksheet, but was able to add combo drop downs and works perfectly now except for the little print issue.
Em,
Read through this before you decide...
http://www.vbaexpress.com/forum/show...ght=print+form
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
MdMack is there a way to have that work for a form.
Lucas I saw that post, but would rather keep it in a form.
Is there a way a can call a module that has the print prompt so it can print the form?
My printer is non-functioning at the moment, but I'll try it at work tomorrow.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Ok Md Thanks. Will look forward to it.
Any Luck with this one?
Em, did you not take a look at the sample that Md supplied?, if you did you would have noticed this section:
[VBA]
Private Sub CommandButton1_Click()
Dim i As Long
If Printer = "" Or Printer = "Not Found" Then Exit Sub
Application.ActivePrinter = Printer
Do
UserForm1.PrintForm
i = i + 1
Loop Until i > Me.TextBox1.Value
Unload frmPrint
End Sub
[/VBA]this in effect loops through thye print form code until i is greater than the value typed in the TextBox!, take a look at the code he supplied trim everything you dont want about setting printers and hey presto sorted!!
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
So then can i have a Inputbox Prompt to equal the value of i ?
OK I am trying this
[vba] Dim l As Long, res As String
'If Printer = "" Or Printer = "Not Found" Then Exit Sub
'Application.ActivePrinter = Printer
res = InputBox("How many Copies?", "Printer")
Do
UserForm1.printform
l = l + 1
Loop Until l > res
Unload frmprint
End Sub
[/vba]
but that's giving me a problem with "frmprint" it's saying it's not defined.
oh ok i just saw the file. I am going to retry it.
Jeeeez! Bob i see what you mean now!
Em you will have a problem with frmprint because if your not using the workbook that Md posted you wont have a UserForm called frmprint!!!!!
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Ok i tried it the right way and got Not Found on both optionbuttons. Do i need to put my printer info somewhere for it to pick it up?