select text after paste

M

mithu

hello everyone,

Question. all this is being done in VBA.

I am copying and pasting some verbiage from doc1 to doc2. this is
working fine. What i am trying to do is have the text that was just
pasted into doc2 be selected or be highlighted after the paste. is
there anyway i can select the text i just pasted?

Many thanks in advance
 
A

aushknotes

Try
1) insert a bookmark before you insert text,
2) Insert your text
3) Selection.GoTo What:=wdGoToBookmark, Name:="bookmarkYouJustCreated"
 
A

aushknotes

Following will work:

Dim oRange As Range
Set oRange = Selection.Range
oRange.Start = Selection.Start
Selection.InsertFile sFile, Range:="", ConfirmConversions:=False,
Link:=False, Attachment:=False
oRange.End = Selection.Start
oRange.Select
 
J

Jean-Guy Marcil

mithu said:
hello everyone,

Question. all this is being done in VBA.

I am copying and pasting some verbiage from doc1 to doc2. this is
working fine. What i am trying to do is have the text that was just
pasted into doc2 be selected or be highlighted after the paste. is
there anyway i can select the text i just pasted?

Try something like this (Do not forget to use Range objecyts as much as
possible...)
This will copy the first paragraph in the document and paste/select it just
before the last one.

Dim rgePaste As Range

With ActiveDocument
.Paragraphs(1).Range.Copy

Set rgePaste = .Paragraphs(.Paragraphs.Count).Range
With rgePaste
.Collapse wdCollapseStart
.Paste
.Select
End With
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top