Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Return to previous location in document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Debra Farnham - 19 Jan 2005 13:48 GMT
Hi All:

Windows 2k
Word 2K

I have written a piece of code that picks up the name of a bookmark, goes to
Table1 in my document, adds a new row and inserts the bookmark text and page
number.  I now need the insertion point to return to the location in the
document that it was prior to entering the bookmark info into Table 1.

Code snippet:

   oTable.Range.Rows(oTable.Rows.Count).Range.Select
   Selection.InsertRowsBelow 1
   Selection.Collapse (wdCollapseStart)
   myrow = Selection.Information(wdStartOfRangeRowNumber)

       If strHeaderText = " in-Ch." Then

               With Selection
                   .TypeText Text:=StrConv(Trim(strFWitnessName),
vbProperCase)
                   .MoveLeft unit:=wdWord, Count:=3, Extend:=wdExtend
                   .Font.UnderLine = wdUnderlineNone
                   .MoveRight unit:=wdCell
                   Selection.InsertCrossReference
ReferenceType:="Bookmark", ReferenceKind:= _
                       wdPageNumber, ReferenceItem:=strBN,
InsertAsHyperlink:=True, _
                       IncludePosition:=False

               End With
       End If

AT THIS POINT I NEED TO RETURN THE INSERTION POINT  TO ITS LOCATION PRIOR TO
EXECUTING ABOVE CODE.  I'm quite certain I could use yet another bookmark
but is there another way?

TIA for any help!

Debra
Jonathan West - 19 Jan 2005 13:52 GMT
Hi debra

Add this to the start of your code

Dim oRange as Range
Set oRange = Selection.Range

At the end, add this line of code

oRange.Select

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hi All:
>
[quoted text clipped - 40 lines]
>
> Debra
Debra Farnham - 19 Jan 2005 13:55 GMT
Amazing!

Thank you so much for your help Jonathan!

Debra

> Hi debra
>
[quoted text clipped - 51 lines]
> >
> > Debra
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.