dbTalk Databases Forums  

Subtotal problem on a worksheet in dts?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Subtotal problem on a worksheet in dts? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
think2much
 
Posts: n/a

Default Subtotal problem on a worksheet in dts? - 03-16-2006 , 07:48 PM






Hi,

Can someone please tell me why this set of codes do not work?
I am getting an error message saying:

Error Code: 0
Error Source: Microsoft VBScript Compilation error
Error Description: Expected Statement
Error on Line: 22

Thanks.
This is my entire code in my DTS package.
-------------------------------------------------------------------------------------------------
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Option Explicit

Function Main()

Dim Excel_Application
Dim Excel_WorkBook
Dim Excel_WorkSheet

Dim sFilename
Dim sSheetName

sFilename = "F:\test.xls"

Set Excel_Application = CreateObject("Excel.Application")

Set Excel_WorkBook = Excel_Application.Workbooks.Open(sFilename)

Excel_WorkBook.Worksheets("Results").Cells.Select
'PROBLEM AREA

'---------------------------------------------------------------------------------------------------
Excel_WorkBook.Worksheets("Results").Cells.Subtota l GroupBy:=1, _
Function:=xlSum, TotalList:=Array(3, 4, 5),
Replace:=True, _
PageBreaks:=False, SummaryBelowData:=True

'---------------------------------------------------------------------------------------------------
Excel_WorkBook.Worksheets("Results").Range("G20"). Select

Excel_Workbook.Save

Set Excel_WorkSheet = Nothing
Excel_WorkBook.Close
Set Excel_WorkBook = Nothing
Excel_Application.Quit
Set Excel_Application = Nothing

Main = DTSTaskExecResult_Success
End Function


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.