I am moving from WordPerfect. I have a macro in word perfect that allows me
to highlight a piece of text and then append it to another file that is not
currently open. This is a quick and handy way for me to put text into
different files without having to open each file, paste the text, then close
it and open another file, etc.
does anyone know if this can be done in Word, and if so, how?
thanks for any help,
Huck
Graham Mayor - 26 Jan 2005 04:56 GMT
You can copy selected text to a new document with the following macro
Sub CopySelectedToNewDoc()
On Error GoTo oops
Selection.Copy
Documents.Add
Selection.Paste
End
oops:
MsgBox "Select the text you wish to copy first!"
End Sub
If you want to copy it to a particular document then you need to add the
extra code in place of Documents.Add
See http://www.gmayor.com/installing_macro.htm and
http://www.gmayor.com/copying_selected_text.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I am moving from WordPerfect. I have a macro in word perfect that
> allows me to highlight a piece of text and then append it to another
[quoted text clipped - 7 lines]
>
> Huck
Huck Rorick - 27 Jan 2005 04:12 GMT
Thank you very much.
I'm sorry to be so ignorant, but what code does one use to specify an
existing document? (And where can I look that sort of thing up? i.e. in
what part of Help?)
thanks
Huck
> You can copy selected text to a new document with the following macro
>
[quoted text clipped - 33 lines]
>>
>> Huck
Graham Mayor - 27 Jan 2005 05:31 GMT
Documents.Open FileName:="""D:\path\filename.doc"""
You could start with investigating the macro recorder and the vba help that
accompanies the vba editor. There is lots of help on vba in the mvps web
site (link in sig. block) and you can get help on the details from the
excellent vba newsgroups on this news server.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Thank you very much.
> I'm sorry to be so ignorant, but what code does one use to specify an
[quoted text clipped - 42 lines]
>>>
>>> Huck