Search Tools Links Login

LDB Read and NetSend

I wanted a way to send messages to the users who are in an access database. This code opens and reads the ldb file for the database (that you specify on the form), reads the user names and sends a message....all without API calls. You can do a lot more with this obviously (I trimmed it down a lot for this forum).
You will need one text box for the source of the ldb file (named txtLocation), one command button, and one text box for your message (named txtMsg).

Original Author: Matt Clingan

Side Effects

To my knowledge, the NetSend Shell command only works with Windows NT.


Private Sub Command1_Click()
'This simple code uses no api calls. it simply opens an ldb file that
'you choose (me.txtLocation) and places the the data in an Array
'For each variable in the array it shoots off a batch 'netsend'
'with a message you supply (me.txtmsg)
Dim strText As String
Dim vArray As Variant
Dim vParse As Variant
Dim iCount As Integer
   Open Me.txtLocation For Input As #1
   Input #1, strText
   For x = 1 To 25 'get rid of spaces-replace with single space
     strText = Replace(strText, " ", " ")
   strText = Replace(strText, " ", ",") 'replace all single spaces with a comma
   vArray = Split(strText, ",", -1) 'find all commas and split into an array
   For Each vParse In vArray
     iCount = iCount + 1 ' Get every other variable in Array (odd numbers)
     If iCount Mod 2 <> 0 Then
       RunBatch = Shell("net send " & _
           vParse & " "" " & txtmsg & """", vbNormalFocus)
     End If
   MsgBox "Message Sent"
   Close #1
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 84 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.