Results 1 to 3 of 3

Excel - Copy / paste from word to excel

Threaded View

  1. #1
    Registered User
    Join Date
    10-10-2010
    Location
    sarnia, mi
    MS-Off Ver
    Excel 2003
    Posts
    2

    Excel - Copy / paste from word to excel

    Hi,
    I am trying to copy a data from word to excel ( multiple files)…Now we are able to copy the data from word to excel, but would like to add simple two steps:
    1. Transpose (the rightmost cells only) and copy/paste row one in the result sheet. Then the second file will be pasted row 2 an so an.
    2.Since we are copying many files( 100 files) from word to excel, would like to delete the previous file from the sheet1 and also get prompt to select the second file ( the new file to copy/paste)

    Sample word and excel file attached..The Result tab is the desired result

    Below is the code we are now using..
    Sub CopyWordTable()
    'requires a reference to Word Object Library (Tools - References)
        Dim appWord As Word.Application
        Dim docWord As Word.Document
        Dim strDoc As String
        Dim tableWord As Word.Table
        
        'Word document and this Excel workbook are in the same folder
        'Table.doc contains a table formatted with various colours, fonts, borders and bullets
        
        strDoc = ThisWorkbook.Path & "\" & "file one.doc"
        
        Set appWord = New Word.Application
        appWord.Visible = True
        
        Set docWord = appWord.Documents.Open(strDoc)
        
        'copy first table in document to clipboard
        Set tableWord = docWord.Tables(1)
        tableWord.Range.Copy
        
        'paste table on worksheet
        ActiveSheet.Paste Destination:=ActiveSheet.Range("A2")
        
        docWord.Close
        appWord.Quit
        
        Set tableWord = Nothing
        Set docWord = Nothing
        Set appWord = Nothing
        
    End Sub


    Thanks in advance...

    Jimmy
    Attached Files Attached Files
    Last edited by Leith Ross; 10-10-2010 at 01:27 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1