Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-16-2022, 06:40 PM
kenny84 kenny84 is offline How to move Section 1.0 (Heading 1) into third page in vba word Windows 10 How to move Section 1.0 (Heading 1) into third page in vba word Office 2016
Novice
How to move Section 1.0 (Heading 1) into third page in vba word
 
Join Date: Jan 2022
Posts: 6
kenny84 is on a distinguished road
Default

I tried this but doesn't work.

StyleName = "Heading 1"

If wdDocTgt.Styles(StyleName).ParagraphFormat.PageBre akBefore Then
MsgBox StyleName & " has 'Page break before' set. Run aborted"
Exit Sub
End If
Set wdDocTgt = ActiveDocument
Selection.HomeKey unit:=wdStory
With Selection.Find
.ClearFormatting
.Style = wdDocTgt.Styles(StyleName)
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With

Do While Selection.Find.Execute
If Asc(Selection.Range.Characters(1)) = 12 Then
Selection.MoveStart unit:=wdCharacter, Count:=1
End If




Selection.Start = Selection.End
Loop
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move Section 1.0 (Heading 1) into third page in vba word Word 2007, cannot insert Section Break (Continuous), only Section Break (Next Page) btse1 Word 3 11-01-2018 09:23 AM
How to move Section 1.0 (Heading 1) into third page in vba word Restarting page numbering only if Section begins with Heading 1 kaurp Word VBA 5 11-02-2017 04:36 AM
How to move Section 1.0 (Heading 1) into third page in vba word Changing a Section Heading to an Appendix Heading stardazy Word 2 11-24-2015 01:04 PM
Cross Reference Heading Number with the word "Section" included bblouin Word 5 12-20-2012 05:27 PM
Prefixing heading numbers with custom letters, varying by section, in Microsoft Word? JoelMarcey Word 0 07-23-2011 08:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:01 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