VB开发——打开Excel并使特定的worksheet处于激活状态

Private Sub Command1_Click()
    Dim strDestination As String
    strDestination = App.Path & "/Excels/20060310.xls"

    Dim xlApp As Excel.Application
    Set xlApp = New Excel.Application
    Set xlApp = CreateObject("Excel.Application")
    '激活EXCEL应用程序
    xlApp.Visible = True
    '隐藏EXCEL应用程序窗口
    Set xlBook = xlApp.Workbooks.Open(strDestination)
    '打开工作簿,strDestination为一个EXCEL报表文件
    Set xlsheet = xlBook.Worksheets("1#高加疏水泄露")
    xlsheet.Select
    '设定工作表
End Sub

原文地址:https://www.cnblogs.com/ainima/p/6331571.html