CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    Runtime error '458' , automation type not supported

    Runtime error '458', variable uses an automation type not supported in visual basic.

    below is code that works on my windows98 p400 system. this code was working on another person's '98 but, has stopped working after i uninstalled and reinstalled the application today. i have deployed dcom98.exe and included mdac_typ.exe in the deployment in an effort to find the problem.

    does anyone know what dependants may be missing?
    my deployment includes:
    MSEXCL35.DLL, MSSTDFMT.DLL,EXCEL8.OLB,VB5DB.DLL



    public Sub ExportToExcel()
    Dim sText as string
    Dim i as Integer, k as Integer, NoSpaces as Boolean
    Dim xlApp as Excel.Application
    Dim xlBook as Excel.Workbook
    Dim xlSheet as Excel.Worksheet
    Dim SelStmt as string
    Dim rs as Recordset
    Dim FName as string
    Dim FileIsThere as Boolean
    Dim sTmp as string
    '...
    set xlApp = new Excel.Application
    set xlBook = xlApp.Workbooks.Add(GetQPath & "Template.xlt")
    set xlSheet = xlBook.Worksheets(1)
    rsQuotes.FindFirst "[QID] = " & CStr(gQID)
    CID = CInt(rsQ!CID)
    sText = rsQ!QNumber
    With xlSheet
    '== enter heading:





    thank you

    Elizabeth

    Elizabeth

  2. #2
    Join Date
    Jul 2001
    Posts
    3

    Re: Runtime error '458' , automation type not supported

    You define "rs" as a recordset, and then you use "rsQuotes" in the code as a recordset, and then the next two lines use "rsQ" as a recordset. Are these all defined somewhere, or are they typos?


  3. #3
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    Re: Runtime error '458' , automation type not supported

    rs is a recordset used elsewhere in the routine.

    rsQ and rsQuotes are one in the same defined globally elsewhere.

    Elizabeth

  4. #4
    Join Date
    Jul 2001
    Posts
    3

    Re: Runtime error '458' , automation type not supported

    Then, the next most likely candidate is the recordset.Open statement. I find this error message comes up when ADO doesn't like the combination of one of my database manipulation statements and the CursorType I used to open the recordset.

    Try changing the CursorType (adOpenDynamic, adOpenKeyset, adOpenStatic) to a different one, and trying it again.

    I have yet to find a reliable, consistent way to use ADO CursorTypes. With different OSes, and different programs doing different things, I can't come up with a reliable pattern. If I get this error, I just roll my eyes, shake my head, change the CursorType and it works.

    Dave


  5. #5
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    Re: Runtime error '458' , automation type not supported

    Dave, below is the code i use to open rs:


    on error resume next
    Screen.MousePointer = vbHourglass
    SelStmt = " SELECT Item, Description, Part, UnitCost, Quantity, Multiplier "
    SelStmt = SelStmt & "FROM BOMList ;"
    set rs = db.OpenRecordset(SelStmt, dbOpenDynaset)
    set xlApp = nothing
    set xlBook = nothing
    set xlSheet = nothing
    If TmplNotThere then Exit Sub

    set xlApp = new Excel.Application
    set xlBook = xlApp.Workbooks.Add(GetQuotesPath & "AutoPack Quote Template.xlt")
    set xlSheet = xlBook.Worksheets(1)
    rsQuotes.FindFirst "[QuoteID] = " & CStr(gQuoteID)
    CustID = CInt(rsQuotes!CustID)
    sText = rsQuotes!QNumber
    With xlSheet
    '== enter heading:




    i use dao rather than ado and i know very little about either so all suggestions help me learn more.

    i was suspecting the excel app (etc.) as being the culprit as it is the only new/different item object being introduced to the application.

    thank you! e

    Elizabeth

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured