'Dim dongexcel As Object
'Dim dongbook As Object
'Dim dongsheet As Object
Dim dongexcel As New Excel. Application
Dim dongbook As Excel. The Workbook
Dim dongsheet As Excel. The Worksheet
Dim J As Integer
If Combo1. Text="dongyang change" Or Combo1. Text="tong crane become" Or Combo1. Text="gold stone change" Or Combo1. Text="deep ze change" Then
'Set dongexcel=CreateObject (" Excel. Application ")
Set dongbook=dongexcel. Application. Workbooks. Open (" C: \ Users/Administrator/Desktop/QC \ dongyang ops class operation task. XLSX ", ReadOnly:=False)
Dongbook. Close True
'Set dongbook=GetObject (" C: \ Users/Administrator/Desktop/QC \ dongyang ops class operation task. XLSX ")
'dongexcel. Visible=True
'Set dongbook=dongexcel. Workbooks. Open (" C: \ Users/Administrator/Desktop/QC \ dongyang ops class operation task. XLSX ")
'dongexcel. Visible=False
The Set dongsheet=dongbook. Worksheets (Combo1. Text)
Combo2. Clear
'read interval name
I=dongsheet. UsedRange. Rows. Count
Combo2. AddItem dongsheet. Cells (1, 1). The Value
For J=2 To I
If dongsheet. Cells (J, 1) & lt;> Dongsheet. Cells (J - 1, 1), Then the
Combo2. AddItem dongsheet. Cells (J, 1). The Value
End the If
Next
The Else
Combo2. Clear
MsgBox "please select a substation!"
End the If
End Sub
Private Sub Combo2_Change ()
Dim V2 As String
Dim II As Integer
V2=Combo2. Text
For II=0 To Combo2. ListCount - 1
If UCase (Combo2. List (II)) Like V2 & amp; "*" Then
Combo2. Text=Combo2. List (II) :
Combo2. SelStart=Len (V2) :
Combo2. SelLength=Len (Combo2. Text) - Len (V2) :
End the If
Next
End Sub
Private Sub Combo2_Click ()
Combo3. Clear
J=1
Dim CDCD As String
CDCD=dongsheet. Cells (J, 1). The Value
For J=1 To I
1, If dongsheet. Cells (J) Value=https://bbs.csdn.net/topics/Combo2.Text Then
Combo3. AddItem dongsheet. Cells (J, 2). The Value
End the If
Next
'Combo3. Clear
'MsgBox "please select operation mission!"
'End If
End Sub
Have read through the combo1 dongsheet this way in combo2 direct reference? And the execution of the Set dongbook=dongexcel. Application. Workbooks. Open (" C: \ Users/Administrator/Desktop/QC \ dongyang ops class operation task. XLSX ", ReadOnly:=False) why would prompt the object of the Open workbook failure, consult, thank you!
CodePudding user response:
Close the UAC, firewall, anti-virus software,...As an administrator to run
CodePudding user response:
I also am dongyang people oh, hengdian, QQ2776478814CodePudding user response: