Hide Page Breaks in Excel 2010

Closed
Poojapriya Posts 6 Registration date Friday October 16, 2015 Status Member Last seen August 8, 2017 - Oct 19, 2015 at 09:31 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Oct 22, 2015 at 10:33 AM
Hello,
Is it possible to hide page breaks in excel while shifting from print preview to normal view using vba?
I know to remove pages breaks manually (options->advanced->show page breaks). I want to remove it through vba.

Thanks in advance!


Related:

4 responses

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Oct 19, 2015 at 11:22 AM
Poojapriya,

A good way to figure out the commands used by vba is to use the macro recorder.

Start recording, change the option, stop recording, take a look at the code.

Let us know if you get stuck somewhere.

Best regards,
Trowa
0
Thanks Trowa!. I tries your answer it shows the command "Activesheet.displaypagebreaks=false". But i need to disable page break option only for a particular workbook. If i done it manually, it will affect other workbooks also. Any ideas?


Pooja.
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Oct 20, 2015 at 11:32 AM
Hi Pooja,

The command only applies to a single sheet. You could write a loop to go through each sheet of your workbook.

I've done it manually as well and that also only applies to the current.

*

After some testing I noticed that by default the page breaks are turned off. If I turn them on, save, close and reload workbook, the page breaks are turned off again.

So I guess you need to use the command ending with True for the sheets you want to show the page breaks (placing the "loop through sheets code" under ThisWorkbook, using "Private Sub Workbook_Activate()" as the first line) by default.

Let me know if I can help you further.

Best regards,
Trowa
0
Thanks Trowa!. I will try out your opinion and let you know .
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Oct 22, 2015 at 10:33 AM
One of the best way to find out that would be, start the macro recorder, manually do what you want to do, stop the recorder. recorder should create the macro for you.
0