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.
--
XP home , Office 97

any or all responses are gratefully accepted and thank you for your time

Re: return to where it was by Helmut

Helmut
Wed Dec 08 02:48:40 CST 2004

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

Re: return to where it was by justamailman

justamailman
Wed Dec 08 03:17:02 CST 2004

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

"Helmut Weber" wrote:

> 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
>

Re: return to where it was by Helmut

Helmut
Wed Dec 08 03:36:12 CST 2004

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

Re: return to where it was by Greg

Greg
Wed Dec 08 05:00:47 CST 2004

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

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

justamailman wrote:
> 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.



Re: return to where it was by justamailman

justamailman
Wed Dec 08 16:15:03 CST 2004

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

"Helmut Weber" wrote:

> 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
>

Re: return to where it was by justamailman

justamailman
Wed Dec 08 16:17:02 CST 2004

thanks Greg but it work fine now for me but i will keep it in mind

"Greg Maxey" wrote:

> 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
>
> --
> Greg Maxey/Word MVP
> A Peer in Peer to Peer Support
>
> justamailman wrote:
> > 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.
>
>
>

Re: return to where it was by Helmut

Helmut
Thu Dec 09 06:25:55 CST 2004

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


Re: return to where it was by justamailman

justamailman
Thu Dec 09 06:53:03 CST 2004

I have only sr1 may be that is why unless I am not looking at the right place

"Helmut Weber" wrote:

> 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
>
>

Re: return to where it was by justamailman

justamailman
Thu Dec 09 08:09:04 CST 2004

found that I had download office sr2 before but it still show version sr1 in
Word, dont understand that. Dont know what to do


"Helmut Weber" wrote:

> 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
>
>

Re: return to where it was by justamailman

justamailman
Thu Dec 09 17:35:06 CST 2004

yes now having SR2 but still no ootion explicit under insert menu. Why?sorry
Helmut

"justamailman" wrote:

> found that I had download office sr2 before but it still show version sr1 in
> Word, dont understand that. Dont know what to do
>
>
> "Helmut Weber" wrote:
>
> > 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
> >
> >

Re: return to where it was by Helmut

Helmut
Sun Dec 12 17:36:26 CST 2004

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/