Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2018, 06:42 AM
jeffreybrown jeffreybrown is offline Start find macro beginning with section 2 Windows Vista Start find macro beginning with section 2 Office 2007
Expert
Start find macro beginning with section 2
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Start find macro beginning with section 2

I have a macro that is looking for specific words within a document and runs a find between those two specific words. All that works fine.

The part I would like to know now is, how can I start the find after Section 1 of the document?

The reason for starting after Section 1, because those keywords I'm trying to find are in the table of contents. There are only a total of two sections within the document.
Reply With Quote
  #2  
Old 09-21-2018, 09:36 AM
gmaxey gmaxey is offline Start find macro beginning with section 2 Windows 7 32bit Start find macro beginning with section 2 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

So where is your macro?

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 9/21/2018
Dim oRng As Word.Range
  Set oRng = ActiveDocument.Sections(2).Range
  With oRng.Find
    .Text = "Test"
    While .Execute
      oRng.Select
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 09-21-2018, 11:18 AM
jeffreybrown jeffreybrown is offline Start find macro beginning with section 2 Windows Vista Start find macro beginning with section 2 Office 2007
Expert
Start find macro beginning with section 2
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Thank you Greg for your reply. I have no access to this site from work, so I posted this question thru my phone. Somewhat difficult to post the macro. I can post the macro when I get home, but in the meantime, I will see if I can get what you have posted to work for my needs. Thanks again.
Reply With Quote
  #4  
Old 09-21-2018, 04:01 PM
jeffreybrown jeffreybrown is offline Start find macro beginning with section 2 Windows Vista Start find macro beginning with section 2 Office 2007
Expert
Start find macro beginning with section 2
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Greg,

Thanks again for you help. I got it to work with you guidance.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start find macro beginning with section 2 How to find and replace random empty spaces in beginning of lines? Pauliina Word 4 05-24-2018 10:01 PM
Start find macro beginning with section 2 word macro To insert text at the beginning and at end of paragraph ArieH Word VBA 20 09-10-2017 04:23 PM
Word 2013 - When deleting section breaks, cursor jumps to beginning of document ranholmom66 Word 3 07-01-2016 06:01 AM
Start find macro beginning with section 2 Find keyword in section & delete section donaldadams1951 Word VBA 5 12-03-2013 10:08 AM
Footnotes in one column section forcing two column section start from a new page... thorin Word 1 12-19-2012 01:22 PM

Other Forums: Access Forums

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