Dear All,

I have a program that I have written in VB6 under the Win 2000 operating system.

However when I try and run the program in Win NT 4 SP5 or Win '95 the program has a Run Time error.

Win '95
Runtime error '432'
File name or class name not found during Automation operation.

Win NT
Runtime error
Automation error
Invalid Syntax

Both these errors occur at the same time in the startup procedure of the program although I don't have VB on the machines with the other operating systems I belive the errors occure when the program gets information about the users login (the current login from the pc)

This is part of the code:
(I have not included all of the code so there are no End Sub etc... statements)

This code comes from another source adapted for my purpose.

Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

lblloginname.Caption = getusr()

Dim User As IADsUser
Dim Group As IADsGroup
'Assigning the current user to a label on the screen.


'Accept the Domain name
strDomain = "Segensworth"

'Use the WinNT Directory Services
strDomain = "WinNT://" & strDomain

'Create the Domain object
Set TheDomain = GetObject(strDomain)
Set theuser = TheDomain.GetObject("user", getusr())

'Displays the Users Full Name
TheDomain.Filter = Array("User")
frmview.lblname.Caption = theuser.FullName


' Function to get the current user login name
Function getusr()
Dim usr As String
usr = Space(256)
aa = GetUserName(usr, 256)
getusr = Left(RTrim(usr), Len(RTrim(usr)) - 1)
End Function

Firstly could anyone please see why this doesn't work in '95 / NT and secondary let me know if it is possible to fix it.

Thanks

Simon