Hello,How to determine printable area width according to active printer?I can see value in Print Preview window when Fit to page is selected in fields for width/height but I need VBA code Greetings!
@ rainbow friends
Hello, To determine the printable area width according to the active printer using VBA code, you can utilize the PageSetup object from the Excel library. Here's an example of how you can achieve this:
vbaSub GetPrintableAreaWidth() Dim ws As Worksheet Dim ps As PageSetup Dim printableAreaWidth As Double ' Set the active worksheet Set ws = ActiveSheet ' Set the PageSetup object Set ps = ws.PageSetup ' Calculate the printable area width in inches printableAreaWidth = ps.PrintableWidth / Application.InchesToPoints(1) ' Display the printable area width MsgBox "Printable Area Width: " & printableAreaWidth & " inches"End Sub
Hello,Thank You for this answer, but he is not working for me. I need code for FIT TO PAGE really. Now FIT TO PAGE is accessible only from Print dialog and not resize really shapes on page to FIT TO PAGE sizes. I wont to know sizeWidth and sizeHeight of Shaperange if all shapes on current page are selected and Shaperange is resized to FIT TO PAGE values.Greetings!