MS Office Forum / Word / Programming / December 2004
return to where it was
|
|
Thread rating:  |
justamailman - 08 Dec 2004 05:33 GMT Hi, i have a macro that goes to find a text and copy it but would like to come back at the last prompt i was at first.
 Signature XP home , Office 97
any or all responses are gratefully accepted and thank you for your time
Helmut Weber - 08 Dec 2004 08:48 GMT Hi, just one of many ways: define where you are, like: dim rHere as range ' you are here set rHere = selection.range ' do what you like rHere.select ' goback
But, of course, this can only work, if you haven't deleted rHere in the meantime, in a way, or changed it by deleting text before it. Theoretically, you could change or delete all of the doc except the end of doc mark (the last paragraph). So the only two safe points you can use for a return, is end of doc in a way, or start of doc, which is the same, if all of doc was deleted. ;-)
Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word 2002, Windows 2000
justamailman - 08 Dec 2004 09:17 GMT thanks. Helmut,is there a place where to learn thoses dim things and how do we see the different choice available as we build using f8 if that is possible
> Hi, > just one of many ways: [quoted text clipped - 17 lines] > "red.sys" & chr(64) & "t-online.de" > Word 2002, Windows 2000 Helmut Weber - 08 Dec 2004 09:36 GMT Hi,
hm... kind of difficult to explain. probably in any book for VBA-beginners. Go to the top of the code in the VBA-Editor, insert Option Explicit which tells VBA, to warn you, if a variable wasn't declared. If you don't know about variables, I really don't know where to start.
Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word 2002, Windows 2000
justamailman - 08 Dec 2004 22:15 GMT sorry option explicit not available to me my WORD in 97 version, may be that is why just a learner here but find it really interesting . your help is precious Helmut
> Hi, > [quoted text clipped - 10 lines] > "red.sys" & chr(64) & "t-online.de" > Word 2002, Windows 2000 Helmut Weber - 09 Dec 2004 12:25 GMT Hi, by the way, in my Word 97 SR-2 there is "option explicit".
Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word 2002, Windows 2000
justamailman - 09 Dec 2004 12:53 GMT I have only sr1 may be that is why unless I am not looking at the right place
> Hi, > by the way, in my Word 97 SR-2 [quoted text clipped - 4 lines] > "red.sys" & chr(64) & "t-online.de" > Word 2002, Windows 2000 justamailman - 09 Dec 2004 14:09 GMT found that I had download office sr2 before but it still show version sr1 in Word, dont understand that. Dont know what to do
> Hi, > by the way, in my Word 97 SR-2 [quoted text clipped - 4 lines] > "red.sys" & chr(64) & "t-online.de" > Word 2002, Windows 2000 justamailman - 09 Dec 2004 23:35 GMT yes now having SR2 but still no ootion explicit under insert menu. Why?sorry Helmut
> found that I had download office sr2 before but it still show version sr1 in > Word, dont understand that. Dont know what to do [quoted text clipped - 7 lines] > > "red.sys" & chr(64) & "t-online.de" > > Word 2002, Windows 2000 Helmut Weber - 12 Dec 2004 23:34 GMT Hi,
>yes now having SR2 but still no ootion explicit under insert menu. Why? you don't insert "Option Explicit", you just type it at the top of a module [ctrl pos1] Probably in English (common), (declarations). --- Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word XP, Win 98 http://word.mvps.org/
Greg Maxey - 08 Dec 2004 11:00 GMT Maybe you coul adapt the following to suit your needs. I use it to insert a bookmark at the insertion point, go off and do a find, and then return to and delete the bookmark.
Sub GoBack() Dim dlgFind As Dialog Set dlgFind = Dialogs(wdDialogEditFind)
With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="IPMark" .DefaultSorting = wdSortByName .ShowHidden = True End With With dlgFind .Find = "" .Show End With Selection.GoTo What:=wdGoToBookmark, Name:="IPMark" ActiveDocument.Bookmarks("IPMark").Delete End Sub
 Signature Greg Maxey/Word MVP A Peer in Peer to Peer Support
> Hi, i have a macro that goes to find a text and copy it but would > like to come back at the last prompt i was at first. justamailman - 08 Dec 2004 22:17 GMT thanks Greg but it work fine now for me but i will keep it in mind
> Maybe you coul adapt the following to suit your needs. I use it to insert a > bookmark at the insertion point, go off and do a find, and then return to [quoted text clipped - 19 lines] > > Hi, i have a macro that goes to find a text and copy it but would > > like to come back at the last prompt i was at first.
|
|
|