
Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Marco,
I added a vbCr at the start of the string in case you are going to use this
code repeatedly.
Dim blnFound As Boolean
Dim aDoc As Word.Document
Dim myText As String
blnFound = False
myText = vbCr & Selection.Range.Text & vbCr & ActiveDocument.Name
'or use .FullName
For Each aDoc In Documents
If aDoc.Path = "" Then
aDoc.Content.InsertAfter myText
blnFound = True
Exit For
End If
If Not blnFound Then
Documents.Add
ActiveDocument.Content.InsertAfter myText
End If
Next aDoc
> Marco,
> This code will add text to the first document it finds not saved or if
[quoted text clipped - 135 lines]
>>
>> Marco

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Co - 19 Oct 2007 20:01 GMT
> Marco,
> I added a vbCr at the start of the string in case you are going to use this
[quoted text clipped - 167 lines]
>
> drsmN0SPAMikleAThotmailD0Tcom.INVALID
Russ,
It copies the text and doc name into the same document, namely the
source document.
What I actually wanted is to select a text by hand, then run the macro
which will take this text
and add a vbNewLine and then the name of the document.
That way I can then with Ctrl-V paste it into another document I have
opened.
Marco
Steve Yandl - 19 Oct 2007 20:47 GMT
Marco,
That is what I provided in my first response but then you said you expected
it to automatically paste as well. If you want a new line started in the
document where you're pasting, you could try changing the line:
strPlus = Selection.Text & ActiveDocument.Name
to
strPlus = vbCrLf & Selection.Text & ActiveDocument.Name
Steve
> Russ,
>
[quoted text clipped - 8 lines]
>
> Marco
Co - 19 Oct 2007 22:09 GMT
> Marco,
> I added a vbCr at the start of the string in case you are going to use this
[quoted text clipped - 167 lines]
>
> drsmN0SPAMikleAThotmailD0Tcom.INVALID
Russ,
It copies the text and doc name into the same document, namely the
source document.
What I actually wanted is to select a text by hand, then run the macro
which will take this text
and add a vbNewLine and then the name of the document.
That way I can then with Ctrl-V paste it into another document I have
opened.
Marco