|
- If session.findById("wnd[0]/sbar").MessageType = "W" Or session.findById("wnd[0]/sbar").MessageType = "E" Then '左下角提示错误信息(没有picking时)
- errtext = session.findById("wnd[0]/sbar").Text '把错误信息写入到D2
- Sheet1.Cells(2, 4).Value = errtext
- Sheet1.Cells(2, 4).Interior.ColorIndex = 3 '红色填充
- Sheet1.Cells(2, 4).Font.Size = 11 '字号11
- Sheet1.Cells(2, 4).Font.ColorIndex = 2 '白色字体
-
- If Sheet1.Cells(2, "D") Like "Object requested is currently locked by user*" Then
- Sheet1.Cells(2, "E") = "项目被占用"
- Application.Speech.Speak "此项被人占用"
- Else
- Sheet1.Cells(2, "E") = "无Picking"
- Application.Speech.Speak "此趟没有TRB胶架大批镜片标签"
- End If
-
- Else
-
-
- With Sheet1
- iRow = .Range("S" & Rows.Count).End(3).Row
- ' If iRow > 1 Then .Range("S2:S" & iRow).Copy
- .Range("S2:S" & iRow).Copy
- End With
复制代码 这里这么多Sheet1,是不是改成以下这样也算是优化代码了?
- If session.findById("wnd[0]/sbar").MessageType = "W" Or session.findById("wnd[0]/sbar").MessageType = "E" Then '左下角提示错误信息(没有picking时)
- errtext = session.findById("wnd[0]/sbar").Text '把错误信息写入到D2
- With Sheet1
- .Cells(2, 4).Value = errtext
- .Cells(2, 4).Interior.ColorIndex = 3 '红色填充
- .Cells(2, 4).Font.Size = 11 '字号11
- .Cells(2, 4).Font.ColorIndex = 2 '白色字体
-
- If .Cells(2, "D") Like "Object requested is currently locked by user*" Then
- .Cells(2, "E") = "项目被占用"
- Application.Speech.Speak "此项被人占用"
- Else
- .Cells(2, "E") = "无Picking"
- Application.Speech.Speak "此趟没有TRB胶架大批镜片标签"
- End If
- End With
- Else
-
-
- iRow = Sheet1.Range("S" & Rows.Count).End(3).Row
- Sheet1.Range("S2:S" & iRow).Copy
复制代码
|
|