[求助]判断机器名,执行文件
我想PC1-PC500号机执行d:\a.exe
PC501-PC1000号执行d:\b.exe
怎么写
Private Sub Form_Load()
Dim cpname As String
Dim num As Long
On Error GoTo errline
cpname = Environ("computername")
num = CLng(Right(cpname, Len(cpname) - 2))
If num >= 1 And num <= 500 Then
Shell "d:\a.exe"
ElseIf num >= 501 And num <= 1000 Then
Shell "d:\b.exe"
End If
Exit Sub
errline:
End Sub