Automation error : Logon failu unknown user name or bad password

Good Day to all you VB guys !

I am currently dealing with VB Macros meant to perform automated functions on MS Excel file/report. MEANING - the code/appcn i am dealing with is V B A appcn not VB6 appcn - its the VB meant for Macros !!

I am getting this error from time to time in various excel reports' execution. Sort of confused about how to resolve this problem right at its root !

Error Msg written into the Error Log :-

"006-09-08 10:38:53#,"","Batches Completed by FIMP"

,"Automation error Logon failure: unknown user name or bad password. ""

I am sure there are many of you here who would have dealt with Macros earlier !!!

Can any1 help me

Thanks in Advance



Answer this question

Automation error : Logon failu unknown user name or bad password

  • MarkGillespie1977

    Moved to VBA forum.


  • Chade

    These forums are for VB.NET, not VBA.

    Also, there's no way to say what the problem is without knowing what the code looks like. If the macro access another server resource such as a fileshare or database, ensure the current user has permission to that resource.

    You should probably go to the Office development website and see if you can find some help there.



  • Ruja

    Hi rkimble, nobugz and every1 else !!

    I am working on a FileNet project [filenet P8] where the use of Process Engine, Content Engine and Image Services is involved. My module under this project is MIS Reports. We basically work in onsite-offshore model.

    In order to do my work as an offshore team member, I connect to Remote Machine via a Terminal Service and do my work on the Filenet tasks as well as Reports.

    During the last 2 months or so, we have been getting this above connection error for all Reports which connect to the CE;

    which we have not been able to resolve.

    The error basically is a runtime error and is thrown from ADO.GetConnection() method inside the VB code of the CE report. Pls look below for code

    exact-code-block ::-

    Public Function GetData(ByVal sDataSource As String, ByVal sDbUser As String, ByVal sDbPswd As String, _
    ByVal sOLAPdns As String, ByVal sOLAPuser As String, ByVal sOLAPpw As String, _
    ByVal strDepartment As String, ByVal StartDate As Variant, ByVal endDate As Variant, _
    ByVal sFreq As String, Optional sRegion As String) As Integer

    ' ************************ DECLARATIONS ************************
    Dim Strsql As String
    Dim adoRec As ADODB.Recordset
    Dim wbBook As Workbook
    Dim wkSheet As Worksheet
    Dim TargetCell As Range
    Dim i As Integer
    Dim strSQL2 As String
    Dim start_date As Date
    Dim startMnth As Variant

    Dim objCustom As FNCE.CustomObject
    Dim arrayDT() As String
    Dim Intn As Integer

    Dim objWorkStepProcessDate As FNCE.MultipleValues
    Dim objWorkStepAction As FNCE.MultipleValues
    Dim objWorkStepNotes As FNCE.MultipleValues
    Dim objWorkStepName As FNCE.MultipleValues
    Dim objCN As ADODB.Connection
    Dim objRS As ADODB.Recordset
    Dim blnfound As Boolean
    Dim flagQC As Boolean
    ' ************************ DECLARATIONS ************************

    Set wbBook = ThisWorkbook
    Set wkSheet = wbBook.Worksheets(1)
    sPath = wbBook.Path
    'get the Month-To-Date

    If (endDate = 0) Or (endDate = Null) Then
    endDate = StartDate
    End If

    Call OpenDBConnection(Trim(sDataSource), Trim(sDbUser), Trim(sDbPswd))

    strDepartment = Get_Workflow(strDepartment)

    Set adoRec = New ADODB.Recordset

    If dbh = "" Then
    GoTo errHand
    End If

    Set adoRec.ActiveConnection = dbh
    adoRec.Open Strsql

    wkSheet.Range("B3").Value = strDepartment
    wkSheet.Range("B4").Value = Format(StartDate, "mmmm, dd ,yyyy")
    wkSheet.Range("B5").Value = Format(endDate, "mmmm, dd ,yyyy")

    wkSheet.Range("A8:D65000").Clear
    'wkSheet.Cells(9, 1).CopyFromRecordset adoRec

    If Not adoRec.EOF Then
    i = 0
    J = 9

    Do While Not adoRec.EOF
    For i = 0 To adoRec.Fields.Count - 1
    Select Case adoRec.Fields.Item(i).Name
    Case "DateReceived", "DateCompleted", "QCDate"
    wkSheet.Cells(J, i + 1) = Format(adoRec.Fields(i).Value, "mm/dd/yyyy")

    Case Else
    wkSheet.Cells(J, i + 1) = adoRec.Fields(i).Value
    End Select
    Next i
    J = J + 1


    flagQC = False
    ' initialize to false

    ''' Here is where I get the above-quoted runtime ERROR
    Set objCN = OS.GetADOConnection

    So far we [offshore or onsite] have not been able to work out a solution to this error. Can there be some problem/issue due to the MDAC data access components [version/upgrade]

    Does any 1 here know/has-worked-with FileNet or MDAC components before Even otherwise - Pls. have a look.

    Pls. suggest/advise, friends.


  • Automation error : Logon failu unknown user name or bad password