|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ERROR: "activex component can't create object: 'excel.application'"Error I get: "activex component can't create object: 'excel.application'" I was told not to load excel into sql server. Well, in any case, there should not be any need to load excel, it recognizes the excel component in the DTS, that means, it should be recognizing excel. Please assist. Thx, Swim. '********************************************************************** ' Visual Basic Transformation Script '************************************************************************ Function Main() ' Initialise dimensions Dim appExcel Dim newBook Dim oSheet Dim oPackage Dim oConn 'Set excel objects Set appExcel = CreateObject("Excel.Application") Set newBook = appExcel.Workbooks.Add Set oSheet = newBook.Worksheets(1) ' Populate heading columns for mapping purposes and display in excel oSheet.Range("A1").Value = "Col1" oSheet.Range("B1").Value = "Col2" oSheet.Range("C1").Value = "Col3" oSheet.Range("D1").Value = "Col4" 'Dynamically specify the name of the new Excel file to be created and exported to DTSGlobalVariables("fileName").Value = "C:\Rpts\cc\a.xls" '" & DTSGlobalVariables("gvID").value & ".xls" With newBook .SaveAs DTSGlobalVariables("fileName").Value .save End With appExcel.quit set oPackage = DTSGlobalVariables.parent 'connection 2 is to the Excel file set oConn = oPackage.connections(2) oConn.datasource = DTSGlobalVariables("fileName").Value 'Destroy objects set oPackage = nothing set oConn = nothing Main = DTSTaskExecResult_Success 'End on success End Function Is your DTS package just exporting to or import from Excel or is it
instantiating Excel from a VBScript task? Show quote "Swim" <crombu***@gmail.com> wrote in message news:1134093275.263026.230460@g44g2000cwa.googlegroups.com... > When I run a DTS, I get the following error. > Error I get: "activex component can't create object: > 'excel.application'" > > I was told not to load excel into sql server. Well, in any case, there > should not be any need to load excel, it recognizes the excel component > in the DTS, that means, it should be recognizing excel. > > Please assist. > Thx, > Swim. > > > > > > > > > '********************************************************************** > ' Visual Basic Transformation Script > '************************************************************************ > Function Main() > > ' Initialise dimensions > > Dim appExcel > Dim newBook > Dim oSheet > Dim oPackage > Dim oConn > > 'Set excel objects > > Set appExcel = CreateObject("Excel.Application") > Set newBook = appExcel.Workbooks.Add > Set oSheet = newBook.Worksheets(1) > > ' Populate heading columns for mapping purposes and display in excel > oSheet.Range("A1").Value = "Col1" > oSheet.Range("B1").Value = "Col2" > oSheet.Range("C1").Value = "Col3" > oSheet.Range("D1").Value = "Col4" > > > 'Dynamically specify the name of the new Excel file to be created and > exported to > > DTSGlobalVariables("fileName").Value = "C:\Rpts\cc\a.xls" > '" & DTSGlobalVariables("gvID").value & ".xls" > With newBook > .SaveAs DTSGlobalVariables("fileName").Value > .save > End With > > appExcel.quit > > set oPackage = DTSGlobalVariables.parent > > 'connection 2 is to the Excel file > set oConn = oPackage.connections(2) > oConn.datasource = DTSGlobalVariables("fileName").Value > > 'Destroy objects > set oPackage = nothing > set oConn = nothing > > Main = DTSTaskExecResult_Success 'End on success > > End Function > |
|||||||||||||||||||||||