Determining current Print Area.

ChadInAtlanta

New Member
Joined
Jan 11, 2009
Messages
27
I have determined how to set the print area of a sheet.

psActivePage.PrintArea = UserRange.Address

But I can't figure out how to get what the current print area range is once it has been set. I would think this would work, but it gives an error.

Set rPrintArea = ActiveWorkbook.Names("Print_Area").RefersToRange
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Not sure if this is what you wanted...
Rich (BB code):
psActivePage.PageSetup.PrintArea = UserRange.Address
rPrintArea = ActiveWorkbook.Names("Print_Area").Address
 
Upvote 0
I had tried that. This is the function I am working in. When I run this, it gives me a run time error 438, Object doesn't support this property or method when I try to set rPrintArea.


Public Sub ExtendLine()
'
'
Dim iCols As Integer
Dim rPrintArea As Range

Set rPrintArea = ActiveWorkbook.Names("Print_Area").Address

'Set rPrintArea = Range("B2", ActiveCell.Address)
rPrintArea.Select

iCols = Selection.Columns.Count
Selection.Find(What:="Notes:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate

ActiveCell.Select
Selection.Resize(1, iCols).Select

With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With

End Sub
 
Upvote 0
I have determined how to set the print area of a sheet.

psActivePage.PrintArea = UserRange.Address

But I can't figure out how to get what the current print area range is once it has been set. I would think this would work, but it gives an error.

Set rPrintArea = ActiveWorkbook.Names("Print_Area").RefersToRange

Greetings Chad,

PrintArea can exist for ea sheet, so you would not refer to ThisWorkbook/ActiveWorkbook. Also, it is a string already, so just:

Code:
strPrintArea=ActiveSheet.PageSetup.PrintArea

...will return the address.

Hope that helps,

Mark
 
Upvote 0
Yes, that works in getting the string ( $B$2:$P$48 ), but I still can't select the range.

These are the things I've tried.
rPrintArea.Address = strPrintArea
rPrintArea(strPrintArea).Select ' I really thought this one should work.
rPrintArea("strPrintArea").Select
 
Upvote 0
Chad

Why do you want to get the range of the print area?
 
Upvote 0
We produce exhibits at work and have standards for what they should look like. In the procedure above, I'm putting a thin line from above the Notes section of the exhibit. But if I can figure out how to select the range, I will check all kinds of little things like font size in the range, that all footnotes are there, determine the number of columns in the range, etc.
 
Upvote 0
Chad,

Just looking at your previous code and your current notation. If you are still trying to set the area to a range first, I don't see any advantage to this for simply selecting the area. Try:

Code:
ActiveSheet.Range(ActiveSheet.PageSetup.PrintArea).Select

Doesn't that do what you want?

Mark
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

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