Find Printed Range using VBA

ChubbyPenguin

New Member
Joined
Dec 8, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm trying to log times when certain sections of a sheet are printed. I can use the Workbook_BeforePrint event to trigger the macro, but ActiveSheet.Range("Print_Area").Address gives the entire set print area instead of the specific printed range. I can use the selected range, but there's always a chance a specific "page" of the print area is printed instead of the selection.

Is there a way to target the printed range instead of the entire print area? Preferrably looking for a solution without implementing a button and an input for a page/range if it's possible.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This will give you the Range of the current Window view.
VBA Code:
Application.ActiveWindow.VisibleRange.Address
 
Upvote 0
And what needs to be done with the answer?
 
Upvote 0
Let me see if I can give a better picture:

I have print areas setup e.g. $E$1:$M$22,$X$1:$AF$22,$AQ$1:$AY$22,$E$24:$M$45,$X$24:$AF$45,$AQ$24:$AY$45
I would like to be able to tell which area(s) are being printed so I can keep a separate table of which section was printed and when.

Checking the selection or visible area probably would be good enough most of the time, but it wouldn't work if sections were printed by selecting the range of pages. If there isn't a way to tell areas E$1:$M$22, $X$1:$AF$22 were printed I may end up going with that, or forcing printing to be done through a macro.
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,210
Members
449,090
Latest member
bes000

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