首页 > 编程语言 > 详细

VBA读取word中的内容到Excel中

时间:2016-01-12 13:42:59      阅读:319      评论:0      收藏:0      [点我收藏+]
原文:VBA读取word中的内容到Excel中

Public Sub Duqu()
     Dim myFile As String
    Dim docApp As Word.Application
    Dim docRange As Word.Range
    myFile = ThisWorkbook.Path & "\Word文档的名字"    ‘指定Word文档
    Set docApp = New Word.Application
    docApp.Documents.Open myFile
    For i = 1 To docApp.ActiveDocument.Paragraphs.Count
    With docApp.ActiveDocument
        ‘If .Paragraphs.Count >= 4 Then
            Set docRange = .Paragraphs(i).Range
            cp = cp & docRange
            
        ‘End If
    End With
      
    Next i
    Range("a1") = cp
    docApp.Quit
    Set docRange = Nothing
    Set docApp = Nothing
    Set ws = Nothing
    
End Sub

VBA读取word中的内容到Excel中

原文:http://www.cnblogs.com/lonelyxmas/p/5123983.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!