-
Why won't this code work? It will send the letter to the text file but not the the number?? Please help me. This is killing me!!!
Code:
Private Sub Form_KeyDown(keycode As Integer, Shift As Integer)
If keycode = 90 Then
Dim zFile As Integer
zFile = FreeFile
Open "C:\Log.txt" For Append As zFile
Print #zFile, "z";
Close zFile
End If
End If
If keycode = 48 Then
Dim aaFile As Integer
aaFile = FreeFile
Open "C:\Log.txt" For Append As aaFile
Print #aaFile, "0";
Close aaFile
End If
End Sub
Thanks,
Kevin
-
You had an extra end if
Code:
Private Sub Form_KeyDown(keycode As Integer, Shift As Integer)
If keycode = 90 Then
Dim zFile As Integer
zFile = FreeFile
Open "C:\Log.txt" For Append As zFile
Print #zFile, "z";
Close zFile
End If
If keycode = 48 Then
Dim aaFile As Integer
aaFile = FreeFile
Open "C:\Log.txt" For Append As aaFile
Print #aaFile, "0";
Close aaFile
End If
End Sub
-
How did you get it so that your post was color coded like VB syntax highlighting?
-
By using UBB Code. You can get a list of those code at http://www.vb-world.net/forums/ubbcode.html.
Dynamo