Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-09-2015, 11:06 AM
spc94 spc94 is offline VBA for Headings Windows 7 64bit VBA for Headings Office 2010 64bit
Novice
VBA for Headings
 
Join Date: Jun 2015
Location: Ohio, USA
Posts: 8
spc94 is on a distinguished road
Default VBA for Headings

I want to input the clients name and then have if fill in the template where I have put the (CLIENT NAME) place holder. When I delete the headers portion of the code it works but when I run it with it I get a " The requested member of the collection does not exist" Error. Any suggestions on how to fix?



strSubName = InputBox("Enter Client Name")

OldWord = "(CLIENT NAME)"
NewWord = strSubName

With ActiveDocument.Content.Find
.Forward = True
.Wrap = wdFindStop
.Execute FindText:=OldWord, ReplaceWith:=NewWord, Replace:=wdReplaceAll, MatchCase:=True
End With

With ActiveDocument.Sections(i).Headers(1).Range.Find
.Text = "(CLIENT NAME)"
.Replacement.Text = strSubName
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Reply With Quote
 

Tags
headings, input boxes, word macros



Similar Threads
Thread Thread Starter Forum Replies Last Post
Templates headings protocoder Word 6 05-14-2014 03:11 PM
Column Headings cinque8 Word 2 06-25-2012 06:15 PM
Captioning with different Headings judicial85 Word 3 03-05-2012 05:06 PM
Headings Metamag Word 5 04-16-2011 09:30 PM
sub headings mahound Word 2 08-20-2008 12:55 PM

Other Forums: Access Forums

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