VBA code to go directly to print settings

oblix

Board Regular
Joined
Mar 29, 2017
Messages
183
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi there
I would like to create an icon on sheet that when you click on it will do the process of going to file tab and clicking on print to display the page where you set the page to page and print from.
can anybody help with vba code. I could on get the print preview to work, but then requires a nother click to go to settings.
thank you in advance
 
Sorry one last question
How do I add the sheet name to this:
Sub DialogPrint()
Dim x As Variant
x = Application.Dialogs(xlDialogPrint).Show(Arg2:=Range("A1"), Arg3:=Range("A2"))
End Sub
or does this not matter?
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
It does, default is your selected sheets
 
Upvote 0
How do I add the sheet name to this:

Maybe

VBA Code:
Sub DialogPrint()
  Dim x As Variant
  With Sheets("PO")
    x = Application.Dialogs(xlDialogPrint).Show(Arg2:=.Range("B4"), Arg3:=.Range("C4"))
  End With
End Sub
 
Upvote 0
Thank you
This works great
 
Upvote 0
Thankyou for help
this solution works
But it does not change the print ranfe from all to pages
can it be done?
 
Upvote 0
Try this:

VBA Code:
Sub DialogPrint()
  Dim x As Variant
  With Sheets("PO")
    x = Application.Dialogs(xlDialogPrint).Show(arg1:=2, Arg2:=.Range("B4"), Arg3:=.Range("C4"))
  End With
End Sub
 
Upvote 0
Solution
Thank you Dante it works, it gives me pages from and to correctly, but the radio button still stays all and one must still select page(s) although page numbers apear correctly
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,795
Members
449,048
Latest member
greyangel23

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