FileName = App.Path & "\" & FileName ' Set the object variable to refer to the file you want to use. Dim excelObj As Object Set excelObj = GetObject(FileName) ' Show Excel through its Application property. excelObj.Application.Visible = True ' Show the window containing the file. Dim winCount As Integer 'winCount = excelObj.Parent.Windows.Count() 'excelObj.Parent.Windows(winCount).Visible = True Set connectXls = excelObj.WORKSHEETS(ShtName) Set excelObj = Nothing End Function
'' Public Function funOpenExcelFile(ByRef xlsApp As Excel.Application, _ ByRef xlsWork As Excel.Workbook, _ ByRef xlsSheet As Excel.Worksheet, _ ByVal strExcelFile As String, _ ByVal strSheetName As String, _ ByVal strPWD As String, _
Private Sub Command1_Click() Dim MyString() As String Open "a.xml" For Binary As #1 ' 打开刚创建的文件。 ReDim MyString(LOF(1) - 1) Put #1, , MyRecord ' 读入所有字符到变量中 ......