|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
* 请 楼主 备份原文件后试用下面的宏:(如果想中途停止执行宏,请按 Ctrl + PauseBreak 组合键)
- Sub aaaa_delete_Empty_Lines_LoopFolder_xiaohualu()
- Dim d, n&, m&, x&, mydir, dk, doc As Document, i&
- Set d = CreateObject("Scripting.Dictionary")
- d(SelectFolder) = ""
- Do While n < d.Count
- dk = d.keys
- mydir = Dir(dk(n), vbDirectory)
- Do While mydir <> ""
- If mydir <> "." And mydir <> ".." Then
- If GetAttr(dk(n) & mydir) = vbDirectory Then
- d(dk(n) & mydir & "") = ""
- m = m + 1
- Else
- x = x + 1
- If dk(n) & mydir Like "*.doc*" Then
- Set doc = Documents.Open(filename:=dk(n) & mydir)
- '-----------------------------------------------------
- Do
- re:
- doc.Tables(1).Cell(13, 2).Select
- With Selection
- .MoveDown Unit:=wdLine, Count:=1
- Do
- If .Cells(1).Range Like "*[0-9]*" Then
- .MoveDown Unit:=wdLine, Count:=1
- Else
- If .Next(4, 1) Like "/*" Then Exit Sub
- .Rows.Delete
- GoTo re
- End If
- Loop
- End With
- Loop
- '------------------------------------------------------
- doc.Close SaveChanges:=wdSaveChanges
- i = i + 1
- End If
- End If
- End If
- mydir = Dir
- Loop
- n = n + 1
- Loop
- Set d = Nothing
- Set dk = Nothing
- MsgBox "Îļt¼D°üo¬ " & x & " ¸öÎļt£¡" & m & " ¸ö×óÎļt¼D£¡" & vbCr & "12′|àí Word ÎÄμμ(*.docx/*.doc) " & i & " ¸ö£¡", 0 + 48
- End Sub
- Function SelectFolder() As String
- With Application.FileDialog(msoFileDialogFolderPicker)
- If .Show Then SelectFolder = .SelectedItems(1) & "" Else End
- End With
- If MsgBox("Are you sure to process " & """" & SelectFolder & """" & " ?", 4 + 16) = vbNo Then End
- End Function
复制代码 |
评分
-
1
查看全部评分
-
|