Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Dec 2001
    Thanked 0 Times in 0 Posts

    GetObject (VBA 2K)

    Where can I find a complete reference for the GetObject function? I have a specific need -- to figure out how to read my local computer's user ID and password -- but I would also like to get a handle on all the capabilities that GetObject offers.

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Arlington, Virginia, USA
    Thanked 3 Times in 3 Posts

    Re: GetObject (VBA 2K)

    Don't know where you'll find a "complete reference" for GetObject - some basic info from MS:

    MSDN Library - GetObject Function

    INFO: GetObject and CreateObject Behavior of Office Automation Servers

    You can search MSDN & MSKB for more info. In any event don't think GetObject would be used for this purpose anyway. To get the name of the currently logged-in user in Windows, you'd use the applicable API function. Example:

    <code>Option Explicit</code>
    <code>Public Declare Function GetUserName Lib "advapi32.dll" _</code>
    <code> Alias "GetUserNameA" _</code>
    <code> (ByVal lpbuffer As String, _</code>
    <code> ByRef nSize As Long) As Long</code>

    <code>Public Function GetLogonName() As String</code>
    <code> Dim lngSize As Long</code>
    <code> Dim strLogon As String</code>
    <code> Dim lngRtn As Long</code>
    <code> </code>
    <code> lngSize = 255</code>
    <code> strLogon = String$(lngSize, 0)</code>
    <code> lngRtn = GetUserName(strLogon, lngSize)</code>
    <code> </code>
    <code> If lngRtn > 0 Then</code>
    <code> strLogon = Left$(strLogon, lngSize - 1)</code>
    <code> Else</code>
    <code> strLogon = vbNullString</code>
    <code> End If</code>
    <code> </code>
    <code> GetLogonName = strLogon</code>
    <code>End Function</code>


    ? GetLogonName

    As for user's password, not even Microsoft, with its infamous security holes & leaks, is going to provide a programmatic method for retrieving a user's password from the operating system. That would make for some great "trustworthy" computing...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts