Click to See Complete Forum and Search --> : Runtime error '458' , automation type not supported


EAK
July 17th, 2001, 01:37 PM
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

rexxrally
July 18th, 2001, 09:51 PM
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?

EAK
July 19th, 2001, 09:30 AM
rs is a recordset used elsewhere in the routine.

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

rexxrally
July 19th, 2001, 09:45 AM
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

EAK
July 19th, 2001, 10:14 AM
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