Results 1 to 3 of 3

Thread: Word

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    30

    Word

    Anyone know how i copy out some text from word doc to another word doc using vba?

  2. #2
    New Member
    Join Date
    Jul 2005
    Posts
    15

    Re: Word

    Can you be more specific? Do you have any code so far?

    You could use

    VB Code:
    1. Dim myDoc as object
    2. Dim strParagraph as string
    3.  
    4. set myDoc = Documents.open (filename.doc)
    5. strParagraph = myDoc.paragraph(1)
    6. myDoc.close savechanges:=false
    7.  
    8. activedocument.typetext strParagraph

    to pull the first paragraph from filename.doc into the selected area of the current doc...

    Hope this helps,
    sugarflux

  3. #3
    New Member
    Join Date
    Jul 2005
    Posts
    7

    Re: Word

    I would also like to know this! I would like to know the fastest way to copy all the text/tables from many documents into one master document. Is this possible with Get and Put? I don't mind saving the contents of these documents in binary with Put (if that is at all possible). At the moment i'm selecting all and copying it across :/

    VB Code:
    1. Documents.Open fileName:=CurrentDir + "Data\" & clauseDoc, ConfirmConversions:=False, _
    2. ReadOnly:=True, AddToRecentFiles:=False, PasswordDocument:="", _
    3. PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
    4. WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    5.        
    6. 'Activate clause file and copy the contents to the clipboard
    7. Documents(clauseDoc).Activate
    8. Selection.WholeStory
    9. Selection.Copy
    10.        
    11. 'Activate This document and paste from the clipboard
    12. ThisDocument.Activate
    13. Selection.Paste

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width