31-01-22 09:21 AM
Hello everyone!
While hoping you all are okay, I want to make a question if someone can help me how to delete the blank pages in Word via Macro .
Thank You,
Erjola
31-01-22 11:31 AM
Sub Demo() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^12[^12^13 ]{1,}" .Replacement.Text = "^12" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub
31-01-22 01:52 PM
Hi Pablo and thank you for your answer but I dont't know why it didn't work
31-01-22 02:56 PM
Sub Demo() Dim par As Paragraph
For Each par In ActiveDocument.Content.Paragraphs
If Len(par.Range.Text) <= 1 Then
par.Range.Delete
End If
Next par End Sub
31-01-22 03:48 PM
31-01-22 03:54 PM
31-01-22 04:10 PM
31-01-22 04:40 PM
31-01-22 04:51 PM
the point is that "the header and footer" are putted also with macro code. The A3 format is putted also with macro .
This Is the reason I could't find a code for deleting blank pages.