I keep getting error message "Only comments can appear after End Sub etc..."
when I try to run this script. Would appreciate any help! Am not a VB
programmer.
Was given this script to use.
'//Declare API Function Declarations from Kernel32 DLL
Declare Function GetEnvironmentVariableA Lib "kernel32" ( _
ByVal lpName As String, _
ByVal lpBuffer As String, _
ByVal nsize As Long) As Long
'Returns Client Computer Name by retrieving 32bit environment variable.
Private Function GetClientComputerName() As String
Dim lStringLength As Long 'Len of String
Dim sEnv As String ''' buffer To hold environment string
'Allocate space for Dos Environment String.
sEnv = Space(4096)
'Get data for given environment variable.
lStringLength = GetEnvironmentVariableA("CLIENTNAME", sEnv, 4096)
'Pull value based on lpszenv length.
GetClientComputerName = Left(sEnv, lStringLength)
End Function
Dirk Goldgar - 31 Aug 2005 16:38 GMT
> I keep getting error message "Only comments can appear after End Sub
> etc..." when I try to run this script. Would appreciate any help! Am
[quoted text clipped - 23 lines]
>
> End Function
There's nothing wrong with the code you posted. Switch the module to
full-module view and look for extraneous statements that don't belong --
for example, executable statements that aren't inside a procedure.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)