用VB来打开指定目录下的Excel

2025-03-25 09:35:14
推荐回答(1个)
回答(1):

Private Sub Command1_Click()
Dim S() As String, i As Integer, j As Integer
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
xlApp.DisplayAlerts = False '不显示对话框
Set xlBook = xlApp.Workbooks.Open("d:\123\234\" & Text1.text) '打开已经存在的EXCEL工件簿文件
xlApp.Visible = True '设置EXCEL对象可见(或不可见)

end sub