|
帮你把函数修改了一下,看行不行?
用这段脚本覆盖窗体的update按纽的click事件.由于每天的上传文件有限,就不给你发文件了.
Private Sub cmdUpdate_Click()
Dim xlsApp As Excel.Application
Dim xlsSheet As Excel.Worksheet
With Me.OLE未绑定20
.Action = acOLEActivate
.Verb = acOLEVerbOpen
End With
Set xlsApp = GetObject(, "Excel.Application")
Debug.Print xlsApp.Workbooks.Count
Set xlsSheet = xlsApp.Workbooks(xlsApp.Workbooks.Count).Worksheets(1)
xlsApp.Visible = True
On Error GoTo handle:
文本44 = xlsSheet.Range("C4").Text
文本47 = xlsSheet.Range("C5").Text
文本49 = xlsSheet.Range("C6").Text
文本51 = xlsSheet.Range("C7").Text
文本53 = xlsSheet.Range("C8").Text
文本55 = xlsSheet.Range("C9").Text
文本57 = xlsSheet.Range("C10").Text
xlsApp.Visible = False
xlsApp.Quit
Set xlsApp = Nothing
文本44.Value = 文本44
文本47.Value = 文本47
文本49.Value = 文本49
文本51.Value = 文本51
文本53.Value = 文本53
文本55.Value = 文本55
文本57.Value = 文本57
Exit Sub
handle:
Call MsgBox("错误信息" & Err.Number & ":" & Err.Description, , "错误")
Resume Next
End Sub |
|