JulienVan
asked on
How to display page limits in Excel?
Hello,
Would you know how to code a macro to display the page limits in Excel, which appear dashed after a print preview?
Thanks by advance
Would you know how to code a macro to display the page limits in Excel, which appear dashed after a print preview?
Thanks by advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or, after you make a Print Preview, you will see the dashed points that you've mentioned.
ASKER
Thanks for your response, I thought that I could show print preview and cancel it, so the page limits would be displayed, but it's not possible, because second line of following function is processed only when print preview is closed by user.
Would you have any idea to do that with another maneer?
Would you have any idea to do that with another maneer?
public static void ShowPageLimits(Excel.Worksheet sheet)
{
sheet.PrintPreview(oMissing);
sheet.Application.SendKeys("{ESC}", oMissing);
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys, I've got it with page break preview!
public static void ShowPageLimits(Excel.Application app)
{
app.Application.ScreenUpdating = false;
app.Application.ActiveWindow.View = Microsoft.Office.Interop.Excel.XlWindowView.xlPageBreakPreview;
app.Application.ActiveWindow.View = Microsoft.Office.Interop.Excel.XlWindowView.xlNormalView;
app.Application.ScreenUpdating = true;
}
ASKER
Some VB or C# code would have been helpful.