Adding blank page in word

sachin483

Board Regular
Joined
Mar 31, 2015
Messages
135
Office Version
2010
Platform
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
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,445
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?
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,078
Messages
5,509,137
Members
408,711
Latest member
EMexcel

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top