J
JOM
I got the following code somewhere, Cant remember where but I would like the
code to send a message to the employees that are logged on, to log out(that
is what the message contains) loggedon is the listbox that contains the list
of people loggedon.....
Private Sub Command1_Click()
Dim strUser As String
Dim i As Integer
Dim strMessage2Send As String
Dim strMessage As String
Dim RunBatch As Double
strMessage = Me.Message
For i = 0 To LoggedOn.ListCount - 1
If LoggedOn.Selected(i) = True Then
strUser = LoggedOn.Column(0, i)
MsgBox Left(strUser, InStr(strUser, "--") - 1)
strMessage2Send = strMessage2Send & "net send " & strUser & " """ & _
strMessage & """" & Chr(13) & Chr(13)
End If
Next
If strMessage2Send = "" Then
MsgBox "Please enter a computer name/user ID"
Exit Sub
End If
RunBatch = Shell(strMessage2Send, vbHide)
MsgBox "Message Sent"
End Sub
code to send a message to the employees that are logged on, to log out(that
is what the message contains) loggedon is the listbox that contains the list
of people loggedon.....
Private Sub Command1_Click()
Dim strUser As String
Dim i As Integer
Dim strMessage2Send As String
Dim strMessage As String
Dim RunBatch As Double
strMessage = Me.Message
For i = 0 To LoggedOn.ListCount - 1
If LoggedOn.Selected(i) = True Then
strUser = LoggedOn.Column(0, i)
MsgBox Left(strUser, InStr(strUser, "--") - 1)
strMessage2Send = strMessage2Send & "net send " & strUser & " """ & _
strMessage & """" & Chr(13) & Chr(13)
End If
Next
If strMessage2Send = "" Then
MsgBox "Please enter a computer name/user ID"
Exit Sub
End If
RunBatch = Shell(strMessage2Send, vbHide)
MsgBox "Message Sent"
End Sub