Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Designing Macros...

Status
Not open for further replies.

rbasram

Programmer
Sep 27, 2001
53
0
0
CA
Suppose you have doc1 and doc2 in microsoft word. Is there a way to design a macro so that if you press any key, whatever text is in doc1 is added to the text of doc2?? (Like backing up). The text is only copied below to the existing text of doc2.

I have no idea how the macros work. Can somebody help!!!!!!!!
 
Your VBA code would look like this....

Sub Macro1()
'select everything in document1
Selection.WholeStory
'copy it all to clipboard
Selection.Copy
'activate the second window (i.e. document2 already open)
Windows(2).Activate
'move cursor to end of text
Selection.EndKey Unit:=wdDocument
'insert a couple of lines
Selection.TypeParagraph
Selection.TypeParagraph
'paste the copied text
Selection.Paste
End Sub

But in truth, all I did was record those keystrokes. It might be worth taking a look at the Windows Help or


Happy learning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top