|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub aa()
Application.ScreenUpdating = False
Dim i%, sr1$, sr2$, x!, myPath$, myFile$, aDoc As Document
myPath = ThisDocument.Path & "\"
myFile = Dir(myPath & "*.doc?")
Do While myFile <> ""
If myFile <> ThisDocument.Name Then
Set aDoc = Documents.Open(myPath & myFile)
With aDoc.Tables(1)
For i = 2 To .Rows.Count - 1
sr1 = Replace(.Cell(i, 2).Range.Text, Chr(7), "")
If sr1 Like "*保洁不到位*" Or sr1 Like "*零星垃圾*" Then
sr2 = "-0.5分"
ElseIf sr1 Like "*卫生差*" Or sr1 Like "*乱搭盖*" Or sr1 Like "*乱张贴*" Or sr1 Like "*乱拉挂" Then
sr2 = "-1分"
ElseIf sr1 Like "*垃圾堆积*" Or sr1 Like "*建筑垃圾*" Then
sr2 = "-2分"
ElseIf sr1 Like "*陈年垃圾*" Or sr1 Like "*卫生死角*" Or sr1 Like "*焚烧垃圾*" Then
sr2 = "-3分"
End If
.Cell(i, 4).Range.Text = sr2
x = x + Val(sr2)
Next
.Cell(.Rows.Count, 4).Range.Text = 100 + x & "分"
End With
aDoc.Close True
End If
myFile = Dir
Loop
Application.ScreenUpdating = True
End Sub |
|