Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2018, 08:56 AM
eduzs eduzs is offline Remove section 2 Windows 10 Remove section 2 Office 2010 32bit
Expert
Remove section 2
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default Remove section 2

I need to remove the section 2, merging the document in only one section with a VBA code.

Code:
Sub Rem_Sec()

Dim oSec As Section, x As Integer

For x = 2 To ActiveDocument.Sections.Count
    ActiveDocument.Sections(x).Headers(wdHeaderFooterPrimary).LinkToPrevious = True
Next x

With ActiveDocument.Range.Find
    .Text = "^b"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Execute Replace:=wdReplaceAll
End With

End Sub
But this code causes a blank header in the final document, the first section loose format.

There's any solution to this?



Thanks.
Reply With Quote
  #2  
Old 11-08-2018, 01:34 PM
macropod's Avatar
macropod macropod is offline Remove section 2 Windows 7 64bit Remove section 2 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

See: https://www.msofficeforums.com/word/...html#post20227
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-08-2018, 03:07 PM
eduzs eduzs is offline Remove section 2 Windows 10 Remove section 2 Office 2010 32bit
Expert
Remove section 2
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

Works fine, thanks.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot remove watermark after section break DLM Word 2 06-12-2018 09:14 AM
Remove Section break Anitha Word 3 12-21-2017 06:00 AM
Remove section 2 How do I remove a section mickapoo Word 11 01-26-2016 06:58 PM
section page numbers reverting to following on from previous section after generating index cloudtrapezer Word 1 06-25-2015 01:16 AM
Remove section 2 Remove unwanted Page in a Section Break JacobReef Word 1 06-10-2012 07:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:57 PM.


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