隨筆 - 12  文章 - 0  trackbacks - 0
          <2018年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          常用鏈接

          留言簿(103)

          隨筆檔案

          文章檔案

          jQuery

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          Public Sub Rdoc() If testing Then Exit Sub On Error GoTo ErrorHandler Dim currentRow As Integer currentRow = ActiveCell.row Dim dateStr As String dateStr = format(Date, "yyyyMMdd") Dim localPath As String localPath = Cells(currentRow, 9) Dim filePath As String Dim wa As Variant Dim wd As Word.document If InStr(Cells(currentRow, 11), ".doc") > 0 Then filePath = Cells(currentRow, 9) & Cells(currentRow, 11) Set wa = CreateObject("Word.Application") wa.Visible = False Set wd = wa.Documents.Open(filePath) Cells(currentRow, 10) = wd.Content.text wd.Close savechanges:=False wa.Quit Set wa = Nothing Else Dim wildcard As String wildcard = "*.doc*" Dim fileText As String Dim fso As Object Dim objFolder As Object Dim myFolder As Object Dim myFile As Object Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(localPath) Then Set objFolder = fso.getfolder(localPath) For Each myFolder In objFolder.SubFolders For Each myFile In myFolder.files If myFile.Name Like wildcard Or myFile.Name = wildcard Then 'MsgBox myFile.path Set wa = CreateObject("Word.Application") wa.Visible = False Set wd = wa.Documents.Open(myFile.path) fileText = fileText & wd.Content.text wd.Close savechanges:=False wa.Quit Set wa = Nothing End If Next Next Set objFolder = Nothing End If Set fso = Nothing Cells(currentRow, 10) = Cells(currentRow, 10) & fileText End If ErrorHandler: If Err.Number <> 0 Then MyMsgBox Err.Number & " " & Err.Description, 10 End If End Sub
          posted on 2018-12-27 10:21 萍水相逢 閱讀(134) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 偃师市| 东阳市| 简阳市| 如皋市| 神农架林区| 台湾省| 连江县| 察隅县| 新营市| 东至县| 江陵县| 丹江口市| 田东县| 岑巩县| 循化| 建德市| 昭平县| 平邑县| 南康市| 鄂托克旗| 黄山市| 图木舒克市| 两当县| 盐津县| 万盛区| 彭泽县| 旬邑县| 鄄城县| 宕昌县| 安丘市| 和田市| 信丰县| 黄龙县| 闻喜县| 秦安县| 涞源县| 九台市| 胶州市| 滨州市| 平塘县| 淮滨县|