Actually, how to do this - delete a specific page?
2 answers
Select the text like this and then do Selection.Delete ()
There are many more ways to do this, but
- There is MSDN, where the insides of Office with tz are described in detail. Vba
- There is a built-in hint in VBA (including auto-completion of names)
so I highly recommend trying it yourself.
- Well, I did the removal of unnecessary pages, but I ran into such a jamb, deleting all unnecessary data, I shifted the top, and at the very end there is a blank page. How to check if the page is empty and delete it? - namak
|
Here, the code that massively removes pages from a document for a given condition:
Sub jumred() Dim S As Section For Each S In ActiveDocument.Range.Sections DEL = True TableCount = S.Range.Tables.Count If TableCount >= 5 Then R = S.Range.Tables(TableCount).Rows.Count C = S.Range.Tables(TableCount).Columns.Count If (Mid(S.Range.Tables(TableCount).Cell(R - 1, 3).Range, 1, 4) = "ЕВДП") And (Val(S.Range.Tables(TableCount).Cell(R - 1, C).Range) > 0) Then DEL = False End If End If If DEL Then S.Range.Delete Next MsgBox "Выполнено полностью", vbInformation End Sub
Start by pressing the F5 key.
|