How to Paste selection to word


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to Paste selection to word

  1. #1
    Bassel Tabbah Guest

    How to Paste selection to word


    In VBA, how can I copy and paste selected items in listbox to my acitve document
    in Word 97. Thank you for your help.

  2. #2
    Duane Guest

    Re: How to Paste selection to word


    "Bassel Tabbah" <tabbah@un.org> wrote:
    >
    >In VBA, how can I copy and paste selected items in listbox to my acitve

    document
    >in Word 97. Thank you for your help.



    I am currently working on a project that does this ( transferres an outlook
    contact to word template). You will
    need to add a reference to the Word 97 object lib.

    I have copied some of the code here. Hope it helps you.

    Duane Snelling dsnelling@msc.ca

    '''''''''''''''
    'This open and edits a document template
    ''''''''''
    Set sWord = CreateObject("Word.Application")
    sWord.Documents.Open sLocation
    ''''''''''''''''''''
    ''''''''''''''''''''
    'Searches through a word document for {\NAME} and inserts to contact name
    everytime found.
    ''''''''''''''''''''
    With Word.ActiveDocument.Content.Find
    .ClearFormatting
    'search name
    Do While .Execute(FindText:="{\NAME", Forward:=True, _
    Format:=True) = True
    With .Parent
    .Delete
    .InsertAfter " " & sContact
    .Move Unit:=wdParagraph, Count:=200
    End With
    Loop
    End With
    ''''''''''''''''''''''''
    'Quit the winword to free resourses
    sWord.Quit SaveChanges:=wdSaveChanges, OriginalFormat:=wdWordDocument


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center