以下是使用 VB.net 的 SSIS 脚本任务中
我已经阅读了这个错误,似乎这行有问题:worksheet = CType(workbook.Sheets(4), Excel.Worksheet)
我的代码如下。我认为对于这里更有经验的人来说这将是简单的。
文本:
Public Sub Main()
Dim excel As New Excel.Application
Dim filename As String = "S:\UK\Clients\Direct\xxxxxxx.xls"
excel.Visible = True
excel.DisplayAlerts = False
Dim workbook As Excel.Workbook
workbook = excel.Workbooks.Open(filename, , False) 'True = ReadOnly
Dim worksheet As Excel.Worksheet
worksheet = CType(workbook.Sheets(4), Excel.Worksheet)
worksheet.Rows(1).delete()
Dts.TaskResult = ScriptResults.Success
End Sub