- ©«¤l
- 4
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows
- ³nÅ骩¥»
- 7
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2012-4-4
- ³Ì«áµn¿ý
- 2017-3-6
|
ºô¶ªí®æ½Æ»s ??
½Ð°Ý¦U¦ì¤j¤j¡Aìµ{¦¡½X(¦p¤U)¡A¥i«ü©w¤é´Á¤U¸üªí®æ¡A¦ý珳¤é¨Ó¡A«o¥u¯à¤U¸ü¨ì³Ì·s¤é´Áªº¸ê®Æ¡A
¤£ª¾vba ¨º¥X¿ù¤F? ½Ð«ü¥¿¡ã ÁÂÁ ¡I
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xDate As String
Worksheets("¶×Á`").Select
xDate = Worksheets("¶×Á`").Range("B6")
With Target
If .Row = 6 And .Column = 2 Then
If .Value <> 0 Then ' ¤é´Á§ïÅÜIJµo¤U¸ü
Worksheets("¥[Åv«ü").Select
With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php"
Do While .Busy Or .readyState <> 4: DoEvents: Loop
With .document
.ALL("qdate").Value = Format(xDate, "E/MM/DD") '¤é´Á¥iקï
.ALL("selectType").Value = "MS"
.ALL("query-button").Click
End With
If InStr(.document.BODY.innerText, "¬dµL¸ê®Æ") Then
If xDate = xDate Then '´ú¸Õ¥Î********
'If xDate >= Date Then '¥¿¦¡±`µ{¦¡½X
Debug.Print xDate 'ÅçÃҥΠ¥i§R°£
xDate = xDate
End If
'.Quit
MsgBox Format(xDate, "YYYY/M/D") & " ¬dµL¸ê®Æ"
Exit Sub
End If
Set A = .document.GetElementsByTagName("table")
.document.BODY.innerHTML = A(3).outerHTML '¨ú³Ì«áªº¤@Ó"table"
.execwb 17, 1 ' Select All
.execwb 12, 2 ' Copy selection
.Quit 'Ãö³¬ºô¶
With Worksheets("¥[Åv«ü").Activate '¥i«ü©w¤u§@ªí
Worksheets("¥[Åv«ü").UsedRange.Clear
Worksheets("¥[Åv«ü").Range("A1").Activate
ActiveSheet.PasteSpecial Format:=HTML, Link:=False, DisplayAsIcon:=False, NOHTMLFormatting:=True
Worksheets("¥[Åv«ü").Columns.AutoFit
End With
End With
Else: .Offset(0, 1) = ""
End If
End If
End With
End Sub |
|