Re: need code to copy paste extended
- From: Co <vonclausowitz@xxxxxxxxx>
- Date: Thu, 18 Oct 2007 23:03:41 -0700
On 19 okt, 00:32, "Steve Yandl" <syandl_nos...@xxxxxxxxxxx> wrote:
It copies the text that was selected in your document appended with the name
of the active document. You didn't specify a target where you wanted it
pasted so I assumed you would be pressing Ctrl plus v or using some other
method to paste the contents into some other Word document or other
application.
If your intent was to send the text to a different word document or some
text log file, there are better ways to go about it than involving the
Windows clipboard. What is the ultimate goal?
Steve
"Co" <vonclausow...@xxxxxxxxx> wrote in message
news:1192744307.789810.290470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 18 okt, 23:07, "Steve Yandl" <syandl_nos...@xxxxxxxxxxx> wrote:
Marco,
You need a reference to the Microsoft Forms object library. Just insert
a
UserForm that won't get used and then go back to a module to create the
subroutine. The sub between the lines should then do what I think you're
asking to do.
______________________________
Sub CopyPlusDocName()
Dim myDataObject As DataObject
Dim strPlus As String
strPlus = Selection.Text & ActiveDocument.Name
Set myDataObject = New DataObject
myDataObject.SetText strPlus
myDataObject.PutInClipboard
End Sub
______________________________
Steve
"Co" <vonclausow...@xxxxxxxxx> wrote in message
news:1192714699.607589.290760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
I need some VBA code that will Copy a highlighted part of a document
to the clipboard including
the name of my document (ActiveDocument.Name).
So when I paste it in a new blanc document I will have the highlighted
text and at the end of it my filename, like:
"This is my highlighted text which was copied from another document".
MySourceDoc.20071018.doc
Marco
Steve,
I don't quite understand.
I inserted a UserForm1 and then ran your code but it doesn't Paste
anywhere.
Marco
The goal is to manually select a part of text in my word document.
Then copy that text together with the name of the document into
another (new)
word document, like:
"This is the text that I am going to copy into a new
Document including the name of the source document"
THE.NAME.OF.MY.SOURCE.DOC.20071019.doc
Marco
.
- Follow-Ups:
- Re: need code to copy paste extended
- From: Steve Yandl
- Re: need code to copy paste extended
- References:
- need code to copy paste extended
- From: Co
- Re: need code to copy paste extended
- From: Steve Yandl
- Re: need code to copy paste extended
- From: Co
- Re: need code to copy paste extended
- From: Steve Yandl
- need code to copy paste extended
- Prev by Date: Re: Renaming documents from text within the document using existin
- Next by Date: Re: Renaming documents from text within the document using existin
- Previous by thread: Re: need code to copy paste extended
- Next by thread: Re: need code to copy paste extended
- Index(es):
Relevant Pages
|