Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 ActiveX Script - Function not found.

Author  Topic 

kd12345
Starting Member

12 Posts

Posted - 2008-03-10 : 15:56:23
I'm trying to create new SSIS package and i'm using one of the control flow Item is "ActiveX Script Task". Following is script.

When i execute the task it errors out that "Function not Found". do i need to create this Function first? I'm new to SQL 2005. so any suggestion will be appreciated.

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

Dim srccsvfile
Dim objExcel
Dim objWorkbook, objWorksheet

srccsvfile = "\\pc17917\c$\Documents and Settings\kdesai1\Desktop\CRM Daily Supervisor Report.xls"

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.displayalerts = False

Set objWorkbook = objExcel.Workbooks.open(srccsvfile)
Set objWorksheet = objWorkbook.WorkSheets("DailyAllCases")
objWorksheet.Activate
objWorksheet.Delete 'this is removing the worksheet instead of rows
objWorkbook.Save 'you must save the change otherwise in trouble

objExcel.Workbooks.Close
Set objWorkbook = Nothing
objExcel.Quit
Set objExcel = Nothing
Main = DTSTaskExecResult_Success
End Function

Please Advice,
KD

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-03-10 : 16:14:59
Active x script has lots of problem in SSIS.
Go to Top of Page

kd12345
Starting Member

12 Posts

Posted - 2008-03-10 : 16:18:06
Same ActiveX Script i tried it in SQL 2000 DTS Package and it worked fine. i don't have to do anything. I don't need to register or anything like that?

Thanks,
KD
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-10 : 16:58:14
Same error came up in a post the other day, but it may be a different issue if there are problems with SSIS.

here: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=98694

Ahh this is related to the other post....

Set objWorkbook = objExcel.Workbooks.open(srccsvfile)
Set objWorksheet = objWorkbook.WorkSheets("DailyAllCases")
objWorksheet.Activate
objWorksheet.Delete 'this is removing the worksheet instead of rows
objWorkbook.Save 'you must save the change otherwise in trouble

if you delete the only worksheet in the file, you may get an error on the save.

Do this instead of the DELETE for this post from earlier
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=98736

objWorksheet.Cells.ClearContents




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

daxxman
Starting Member

1 Post

Posted - 2009-02-23 : 15:09:26
make sure your entry method is defined as Main().
Go to Top of Page
   

- Advertisement -