Print button that prints the listed parameters

DeanML

New Member
Joined
May 15, 2019
Messages
2
I am fairly efficient with the internal commands of excel, but VBA's are very new to me. It took me 4 hours to program a saveas button, but with a lot of internet searching I was able to determine where my issues were. Now I have been trying another button on the same page for a "Print" function. Its a dynamic form that will not be modified other than filled in data. So I want to program a form control button to print the following:
Range
Portrait
Fit to page
Current Printer

I haver been all over the board with this and maybe because the places I look the help I for older versions of excel.

Any help would be appreciated.
JV
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Record a macro where you set the printing parameters and click print.

If you need help editing the recorded macro, post the macro here and ask for help.
 
Last edited:
Upvote 0
Sub Button_Click_2()
ActiveSheet.PrintOut
Range("A1:J61").Select
ActiveSheet.PageSetup.printArea = "A1:J61"
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate _
:=True
End Sub

I can print, but it is double printing. Almost like the button gets pressed twice...

Joe
 
Upvote 0
Code:
[COLOR=#333333]Sub Button_Click_2()[/COLOR]
[COLOR=#333333]ActiveSheet.PageSetup.printArea = "A1:J61"[/COLOR]
[COLOR=#333333]ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate[/COLOR][COLOR=#333333]:=True[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top