如何用VB打开一个EXCEL文件
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("f:\test.xls")
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Range("E3").Value = "bbb"
Dim ExclFileName As String
ExclFileName = "f:\箱单.xls"
If Dir(ExclFileName) <> "" Then
Kill ExclFileName
End If
xlSheet.SaveAs (ExclFileName)
xlApp.Application.Visible = True
交还控制给Excel
xlSheet.PrintPreview