Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2013, 07:59 AM
Peter Stahl Peter Stahl is offline Select a area in a Word Document Windows 7 64bit Select a area in a Word Document Office 2010 64bit
Novice
Select a area in a Word Document
 
Join Date: Aug 2013
Posts: 2
Peter Stahl is on a distinguished road
Default Select a area in a Word Document

I want a Word Macro that can find a word in a document then select everything from the end of that line that word was found in to the top of the document. Then do a copy and paste special to text. Here's what I have so far but once it moves to the top nothing is selected. Any suggestion?

signed confused.

Sub test3()
With ActiveDocument.Content.Find
.Text = "Safety Stock"
.Forward = True
.Execute


If .Found = True Then
.Parent.Select
Selection.Expand wdLine
myRange = Selection

End If

End With

ThisDocument.Bookmarks("\StartOfDoc").Select

End Sub
Reply With Quote
  #2  
Old 08-08-2013, 06:43 PM
gmaxey gmaxey is offline Select a area in a Word Document Windows 7 32bit Select a area in a Word Document Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
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

This should get you on track

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .Text = "Safety Stock"
    If .Execute Then
      
      oRng.Select
      Selection.Expand wdLine
      Selection.Start = ActiveDocument.Range.Start
    End If
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 08-09-2013, 03:18 AM
Peter Stahl Peter Stahl is offline Select a area in a Word Document Windows 7 64bit Select a area in a Word Document Office 2010 64bit
Novice
Select a area in a Word Document
 
Join Date: Aug 2013
Posts: 2
Peter Stahl is on a distinguished road
Default

Gregg,

thanks, that's exactly what I needed. I can stumble around with Excel Macro but the Word Macros are different.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Select a area in a Word Document How to edit cell data without changing print area. FIXED print area VictoriaT8 Excel 3 02-22-2013 07:54 PM
Select a area in a Word Document Recovering a word file (Select the encoding that makes your document readable) Canni Word 2 08-29-2012 02:46 PM
Select a area in a Word Document Select all textboxes in Word document msword270 Word 1 01-12-2012 11:41 AM
Unable to select anything in an MS Word Document PaulT Word 0 08-08-2011 07:45 PM
Select a area in a Word Document Select printer to document JosL Office 3 03-07-2009 12:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:43 AM.


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