如何让VBs 同时执行两行代码

例如
on error resume next
(代码A)-------------如下----------------------------
msgbox chr(13) + chr(13) + chr(13) + "123"
....
...
....
(代码B):———如下—————————
msgbox chr(13) + chr(13) + chr(13) + "456"
-----
----
----
-----
END

要求是代码A和B同时运行且互不干扰
如何实现?

第1个回答  2011-11-29
RunAs "sub1"
RunAs "sub2"

Sub sub1
MsgBox "code1"
End Sub

Sub sub2()
MsgBox "code2"
End Sub

Sub RunAs(Byval e)
'Author:次碳酸钴
Dim txt,match,path,file,myname
myname=WScript.ScriptName
With CreateObject("Scripting.FileSystemObject")
path=.GetSpecialFolder(2)&"\"&e&myname
txt=.OpenTextFile(myname).ReadAll
With New RegExp
.Pattern="sub\s+"&e&"(?:\(\s*\))?([\s\S]+?)end\s+sub"
.IgnoreCase=True
Set match=.Execute(txt)(0)
End With
.OpenTextFile(path,2,1).Write match.SubMatches(0)
CreateObject("WScript.Shell").Run path
End With
End Sub本回答被提问者采纳
相似回答