ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] (EXCEL VBA°ÝÃD)½Ð°Ý«ç¼Ë¥ÎQueryTable§ì¨úºô­¶¸ê®Æ?

­×§ï§ì¨úªí®æ°Ñ¼Æ§A¸Õ¬Ý¬Ý

Sub Ex()
        Dim xDay As String
        xDay = InputBox("¿é¤J¤é´Á", "¤j½L²Î­p¸ê°T¤é´Á", Date)
        If IsDate(xDay) Then
            If Weekday(xDay, vbMonday) < 6 Then
                xDay = Format(xDay, "yyyymmdd")
                With ActiveSheet.QueryTables.Add(Connection:= _
                    "URL;http://www.twse.com.tw/exchangeReport/MI_INDEX?response=html&date=" & xDay & "&type=ALLBUT0999" _
                    , Destination:=Range("A1"))
                    .WebFormatting = xlNone
                    .RefreshStyle = xlInsertDeleteCells
                    .AdjustColumnWidth = True
                    .Refresh BackgroundQuery:=True
                End With
            Else
                MsgBox xDay & "  °²¤é¨SÀç·~"
            End If
        Else
            MsgBox "¤é´Á¿é¤J¿ù»~"
        End If
    End Sub
Rogersg

TOP

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD