Adding blank page in word

sachin483

Board Regular
Joined
Mar 31, 2015
Messages
163
Office Version
  1. 2019
Platform
  1. Windows
i have to added blank page in word 2010 after every 3 , 6 , 9 , 12 till the end the below macro run but blank page is not inserted and the format should remain same

Code:
Sub PB()
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
        .MatchWildcards = False
        .ClearFormatting
        .Text = "^p^p^p ^m"
        .Replacement.ClearFormatting
        .Replacement.Text = ""
        .Execute Replace:=wdReplaceAll
    End With
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
        .MatchWildcards = True
        .Text = "(^13{3,}*^13{3,}*)^13{3,}"
        .Replacement.Text = "\1^m^m"
        .Wrap = wdFindStop
        .Execute Replace:=wdReplaceAll
    End With
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
i have to added blank page in word 2010 after every 3 , 6 , 9 , 12 till the end
After "every 3 , 6 , 9 , 12" what? As it is, your code first deletes every set of 3 paragraph breaks followed by a space then a manual page break, before trying to find 3 or more paragraph breaks followed by anything at all until finding 3 or more paragraph breaks followed by anything at all until finding 3 or more paragraph breaks, replacing the last set of 3 or more paragraph breaks with two manual page breaks. What do you expect it to do? And what do you mean by "the format should remain same"? Same as what?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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