- ©«¤l
- 169
- ¥DÃD
- 41
- ºëµØ
- 0
- ¿n¤À
- 219
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-7-31
- ³Ì«áµn¿ý
- 2023-9-15
|
Option Explicit
Dim IE As Object, Combo_Ar(), xMsg As Boolean, xButton As Boolean, xRng As Range
Private Sub Label6_Click()
End Sub
Private Sub UserForm_Initialize()
'ComboBox ±±¨î¶µ -> ¿¤¥«'¨Æ°È©Ò¦WºÙ '¶mÂí¥«°Ï'¬q'¤p¬q
Combo_Ar = Array(ComboBox0, ComboBox1, ComboBox2)
Set IE = CreateObject("InternetExplorer.Application")
Set xRng = [B36 ]
' Label1 = ""
xRng.Resize(, ¢µ) = ""
With IE
'.Visible = True '¥i¤£Åã¥ÜIE
.Navigate "http://lisp.land.moi.gov.tw/MMS/MMSpage.aspx#gobox03"
Do While .Busy Or .readyState <> 4: DoEvents: Loop
ComboBox_list 0
End With
End Sub
Private Sub ComboBox_list(ByVal Op As Integer)
'¿¤¥«'¨Æ°È©Ò¦WºÙ '¶mÂí¥«°Ï'¬q'¤p¬q ªº¿ï¶µ¤º®e¾É¤JComboBoxªºlist
Dim xSelect As Object, i As Integer, x As Integer
xMsg = True
'xButton = True
For i = Op To UBound(Combo_Ar)
With Combo_Ar(i)
If i = Op And .ListCount = 0 Then
Do
Set xSelect = IE.Document.all.tags("SELECT")(i)
Loop Until xSelect.Length > 0
' MsgBox .List(1)
For x = 0 To xSelect.Length - 1
.AddItem
.List(.ListCount - 1, 0) = xSelect(x).innertext
Next
.ListIndex = 0
ElseIf i = Op And .ListIndex > 0 Then
Do
Set xSelect = IE.Document.all.tags("SELECT")(i)
Loop Until xSelect.Length > 0
xSelect.selectedIndex = .ListIndex
If Op <> UBound(Combo_Ar) Then
xSelect.fireEvent ("onchange")
Do While IE.Busy Or IE.readyState <> 4: DoEvents: Loop
Do
Set xSelect = IE.Document.all.tags("SELECT")(i + 1)
Loop Until xSelect.Length > 0
With Combo_Ar(i + 1)
.Clear
For x = 0 To xSelect.Length - 1
.AddItem
.List(.ListCount - 1, 0) = xSelect(x).innertext
Next
.ListIndex = 0
End With
End If
ElseIf i > 0 Then
If Combo_Ar(i - 1).ListIndex = 0 Or Combo_Ar(i - 1).ListCount = 0 Then
.Clear
End If
End If
If .ListCount = 0 Or .ListIndex = 0 Then xButton = False
If UBound(Combo_Ar) = i And .ListCount > 0 Then
If .ListCount = 2 And .List(1) = "" Then xButton = True
If .ListCount = 2 And .List(1) <> "" And .ListIndex > 0 Then xButton = True
If .ListCount > 2 And .ListIndex > 0 Then xButton = True
End If
End With
Next
If xButton Then
button_Click
Else
xRng.Cells(1, 6) = ""
'Label1 = ""
End If
xMsg = False
End Sub
Private Sub ComboBox0_Change() '¿¤¥«
If xMsg = False Then ComboBox_list 0
xRng.Cells(1, 2) = ComboBox0.Value
End Sub
Private Sub ComboBox1_Change() '¨Æ°È©Ò¦WºÙ
If xMsg = False Then ComboBox_list 1
xRng.Cells(1, 3) = ComboBox1.Value
End Sub
Private Sub ComboBox2_Change() '¶mÂí¥«°Ï
If xMsg = False Then ComboBox_list 2
xRng.Cells(1, 4) = ComboBox2.Value
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
IE.Quit
End Sub
Private Sub button_Click() '¬d¸ß
Dim xIObject As Object, E
With IE
Do
Set xIObject = .Document.all.tags("INPUT")
Loop Until Not xIObject Is Nothing
For Each E In xIObject
If E.Value = "¬d¸ß" And E.Type = "button" Then
E.Click
Exit For
End If
Next
Do While .Busy Or .readyState <> 4: DoEvents: Loop
Do
Set xIObject = .Document.all.tags("STRONG")(0)
Loop Until Not xIObject Is Nothing
End With
E = xIObject.innertext
'Label1 = Split(xIObject.innertext, "¡G")(1)
xRng.Cells(1, 1) = "'" & Split(xIObject.innertext, "¡G")(1)
Label8 = Split(xIObject.innertext, "¡G")(1)
End Sub
¥Ø«e¥u¯à§ì¨ì²Ä¤@ÓÈ,¦ý²Ä¤G¡B¤TÓȧ줣¨ì¡A¤£ª¾¨º¦ì¤j¤j¯àÀ°¦£¡A·P®¦ |
|