隨筆 - 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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 柳江县| 正定县| 堆龙德庆县| 宁津县| 竹山县| 岢岚县| 韶关市| 高清| 祁门县| 吉木萨尔县| 瑞昌市| 团风县| 海口市| 临沧市| 哈巴河县| 临沂市| 永新县| 临沭县| 乌拉特前旗| 大关县| 绥江县| 浏阳市| 新野县| 建昌县| 行唐县| 咸丰县| 米泉市| 新丰县| 科技| 昌邑市| 南汇区| 那曲县| 万载县| 西畴县| 北川| 阳泉市| 岳阳市| 龙门县| 普洱| 北票市| 灵石县|