Private Sub Command1_Click() Dim sFile As String With CommonDialog1 .DialogTitle = "open" .CancelError = False .Filter = "EXCELÎļþ(*.xls)|*.xls|ËùÓÐÎļþ (*.*)|*.*" .ShowOpen If Len(.FileName) = 0 Then Exit Sub End If sFile = .FileName End With
Dim mx As Integer
Dim yx
Dim excelApp As Excel.Application Set excelApp = New Excel.Application excelApp.Workbooks.Open FileName:=sFile 'xlApp.Visible = True excelApp.Worksheets(2).Activate mx = excelApp.Cells(9, 5) Text1.Text = mx excelApp.Workbooks.Close excelApp.Quit Set excelApp = Nothing
End Sub¿ÉÒÔ½«µÚÒ»¸ö°´Å¥ÀïµÄ´úÂëд³É×Ô¶¨Ò庯Êý. ÇåÊý¾Ý: excelApp.sheets(2).cells(6,3).clearcontents excelApp.Worksheets(2).Range("C6").Delete ллlsµÄ ÄÇÈç¹ûҪɾ³ý¸ÃÐеÚÁùÁÐÖ®ºóµÄËùÓÐÄÚÈݸÃÔõôдѻ·ÄØ£¿