Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-08-2018, 07:35 PM
macropod's Avatar
macropod macropod is offline Need to apply Heading1 to select rows Windows 7 64bit Need to apply Heading1 to select rows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,527
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

For what you've described, all you need is:
Code:
Sub HeaderApply()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Forward = True
  .Format = False
  .Wrap = wdFindContinue
  .MatchWildcards = False
  .Text = "C:\_XREF_ALL\App.2018"
  With .Replacement
    .ClearFormatting
    .Text = "^&"
    .Style = wdStyleHeading1
  End With
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
but you don't even need a macro for this - just an ordinary Find/Replace with 'Heading 1' specified as the replacement Style.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to apply Heading1 to select rows Select rows w/cells containing given character strings, then sum cell in two other col. LarryHills Excel 1 02-17-2017 03:55 PM
VBA Word Table - Select More than 1 Column at a time - Apply Formatting jc491 Word VBA 12 09-24-2015 06:03 AM
Need to apply Heading1 to select rows TOC showing both Heading1 and Page Number FormatAdmin Word 3 03-04-2014 01:20 PM
Need to apply Heading1 to select rows reference previous heading1 fehenry Word 5 04-20-2012 01:54 AM
Heading1 does not convert to Kop1 boesh Word 8 07-02-2010 05:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:07 AM.


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