#1
|
|||
|
|||
Remove Page Break in VBA
I have created a macro to resize and format a report from a text file. I have added a macro to add a page break prior to a certain word that appears at the top of each page in the text file. The problem is my report always give me a blank page to start the completed report. How can I remove that initial page break ONLY?
Mike |
#2
|
||||
|
||||
Depending on what's on the first page it might be nothing more complicated than:
ActiveDocument.Range.Characters.First.Delete
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
That didn't work. The first page still shows up as blank. I can bring up the hidden characters and it looks like a bunch of small dots with Page Break in the middle.
|
#4
|
||||
|
||||
That suggests there's something other than just the page break on your first page - paragraph breaks and/or spaces perhaps? If there's just a single paragraph break (a symbol that looks like ¶) before the page break, simply execute the line of code I posted twice. If there's more than that, post back with the details.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I got it figured out. You can't use the mouse to select items when using the record macro tool. So I just used the keyboard when recording to get the code for removing the page break and it worked. I just used shift/end to highlight and then delete. Thanks for your help.
Mike |
#6
|
||||
|
||||
That's a less-than-ideal way of doing things in VBA but, if it works for you, I guess that's what matters.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Delete a page after Section Break Next Page | Aston | Word | 9 | 04-27-2022 07:38 AM |
First section will not 'insert' blank page even though sectn 2 is 'odd' page break | Pat_Hodgson | Word | 6 | 12-01-2013 04:22 PM |
Section Break (Next Page) replaces Section Break (Continuous) when deleted | Carlabasson | Word | 2 | 03-25-2013 10:13 PM |
Remove unwanted Page in a Section Break | JacobReef | Word | 1 | 06-10-2012 07:04 AM |
How do I Remove Break? | freschij | Word | 1 | 11-05-2010 08:40 AM |