在vba中用sendcommand,好像与vba执行并不是同步的,比如下面这段代码,多次执行的结果并不是相同的,请问有什么办法能确保sendcommand的语句在acad中执行完毕后再执行sendcommand下一句vb代码?
Sub bb() lsp = "(command ""text"" ""mc"" """ & 0 & "," & 0 & """ ""2"" ""0"" """ & "0" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 1 & "," & 1 & """ ""2"" ""0"" """ & "1" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 2 & "," & 2 & """ ""2"" ""0"" """ & "2" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 3 & "," & 3 & """ ""2"" ""0"" """ & "3" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 4 & "," & 4 & """ ""2"" ""0"" """ & "4" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 5 & "," & 5 & """ ""2"" ""0"" """ & "5" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 6 & "," & 6 & """ ""2"" ""0"" """ & "6" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 7 & "," & 7 & """ ""2"" ""0"" """ & "7" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 8 & "," & 8 & """ ""2"" ""0"" """ & "8" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 9 & "," & 9 & """ ""2"" ""0"" """ & "9" & """)" ActiveDocument.SendCommand lsp & vbCr lsp = "(command ""text"" ""mc"" """ & 10 & "," & 10 & """ ""2"" ""0"" """ & "10" & """)" ActiveDocument.SendCommand lsp & vbCr
End Sub
|