Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2012, 01:39 PM
wordpunk wordpunk is offline Delete Page Break using VBA Windows XP Delete Page Break using VBA Office 2007
Novice
Delete Page Break using VBA
 
Join Date: Jul 2012
Posts: 1
wordpunk is on a distinguished road
Default Delete Page Break using VBA

Hello All,



This may be a very simple issue to all of you but I have been having hard time cracking this.

I have a word template which is of 2 pages, it has just one page break, I have vba code in Excel, which opens this template, manipulates something and then saves the template with a different name.

However, I have now realized that in some cases I need to delete that page break. What vba code should I include to make this happen.

Any help would be greatly appreciated!
Reply With Quote
  #2  
Old 07-03-2012, 03:05 PM
macropod's Avatar
macropod macropod is offline Delete Page Break using VBA Windows 7 64bit Delete Page Break using VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,382
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub Demo()
Dim Rng As Range
With ActiveDocument
  Set Rng = .GoTo(What:=wdGoToPage, Name:=1)
  Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
  Rng.End = Rng.End - 2
  Rng.Collapse wdCollapseEnd
  If Asc(Rng.Characters.Last) = 12 Then Rng.Delete
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Page Break using VBA Delete a page after Section Break Next Page Aston Word 9 04-27-2022 07:38 AM
Delete Page Break using VBA Page break formatting changes Tom0822 Excel 1 03-19-2012 08:50 PM
Delete Page Break using VBA Page break problem don madsen Word 1 09-03-2011 07:46 AM
paragaph hard break, soft break and ...strange break czomberzdaniela Word 2 12-03-2010 06:58 PM
Page Break Manolo Word 0 04-29-2009 11:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft