#1
|
|||
|
|||
Moving to a particular word in a document
This is about editing large literary documents.
Using a macro which I've written I can find many of the punctuation and other errors and list them on a summary document. This summary document gives the word number where a 30 word extract starts and it prints the extract. A typical entry might read "1675 the baby through the Tedy Bear out of the pramm..(and so on)" It would help me a lot if I could create a new macro, enter the number 1675 and be taken to that bit of the document around words(1675). I can't seem to find a suitable instruction. I tried things like words(p).show, but I can't figure out what I need. Any help will be gratefully received |
#2
|
|||
|
|||
Sorry if I'm not following - but why can't you just use the Find tool (Ctrl + F) and go to the words that way?
|
#3
|
|||
|
|||
Selection.WholeStory
With Selection.Find .Text = "1675" .Execute End With
__________________
Backup your original file before doing any modification. |
#4
|
||||
|
||||
You need to modify your original macro to bookmark the problem locations with a bookmark name e.g bm1675. You can then easily go to that bookmark.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Bookmarks
Graham,
Yes, I can see this would work OK, but ... I am looking through my Mackenzie and Martins but I cannot find how to add a bookmark from the macro. (Also, although I never work with the original scripts, it would be good if I could rub out the bookmarks once I've finished with them) |
#6
|
||||
|
||||
Without seeing your macro it is difficult to advise how to add to it. Basically you set a bookmark to the range that you have found as you add it to your log.
To go to the bookmark - let's assume you have added bookmarks bm1 to bm10 i.e a number following 'bm'. Then the following macro will prompt for a number and then select the numbered bookmark and delete the bookmark (but not its content). Code:
Sub GetBM() Dim sBM As String On Error GoTo lbl_Exit sBM = InputBox("Go to which bookmark number") With ActiveDocument.Bookmarks("bm" & sBM) .Range.Select .Delete End With lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#7
|
|||
|
|||
Thank you
Thanks for the code. I also found a lot of stuff in the Microsoft archives, so I think I'll be able to manage this now. I'm grateful for your advice.
|
Tags |
editing |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
moving charts around a word document | rich_cirillo | Word | 1 | 05-13-2014 07:10 PM |
Moving Quick Parts with the document | derohanes | Word | 4 | 10-23-2013 09:30 PM |
Adding and Moving parts of a document in Word | PauledInAction | Word | 4 | 07-13-2012 02:38 PM |
Moving a Long Document | clpix | Word | 1 | 01-14-2010 08:55 PM |
problem moving text to blank document | carolanshaw | Word | 0 | 03-23-2009 08:45 PM |