现在是有几个数据根式都相同的WORD格式的文件,如何才能实现把WORD里面的数据导入到EXCEL中去!谢谢! 

解决方案 »

  1.   

    传个附件上来.或者发送到[email protected]
      

  2.   


    谢谢老师!CSDN好像不能传附件哦!我发邮箱吧!
      

  3.   

    打开excel 文件VBE界面,新建模块,引用WORD对象,执行下面的代码:Sub macro1()
    Dim wd As New Word.Application, doc As New Word.Document, i As Long, t As Word.Table
    wd.Visible = True
    Set doc = wd.Documents.Open(ThisWorkbook.Path & "\a.doc")
    Set t = doc.Tables(1)
    [a2].Resize(1, 11) = Array(t.Cell(1, 2), t.Cell(1, 4), Mid(t.Cell(1, 5), 7, 7), t.Cell(2, 2), t.Cell(2, 4), t.Cell(2, 6), t.Cell(3, 2), t.Cell(3, 4), t.Cell(3, 6), t.Cell(4, 2), t.Cell(4, 4))
    [2:2].Replace "", ""
    t.Cell(1, 6).Select
    wd.Selection.MoveRight Unit:=wdCell
    wd.Selection.Copy
    [l2].Select
    ActiveSheet.Paste
    doc.Close
    wd.Quit
    End Sub