Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.ComponentModel
Imports System.IO
Imports Microsoft.Office.Interop.Excel
Public Class ScriptMain
Public Shared Sub Main()
Dim storefile As Directory
Dim directory As String
Dim files As String()
Dim file As String
Dim FileName As String, FolderName As String
FolderName = "\\acct.upmchs.net\psd\ccm\main\CCM_Report_Data\billing_Inbound\"
files = storefile.GetFiles(FolderName, "*.xls")
For Each file In files
Dim excel As New Microsoft.Office.Interop.Excel.Application
Dim Book As Workbook
Book = excel.Workbooks.Open(file)
Book.SaveAs(FolderName & "data.xls")
'I'll add code to change the worksheet name at a later date
Book.Close()
Next file
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
|