| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-10-2 13:08 ½s¿è 
 ¦^´_ 1# BigDog
 ¥þ¤åÀ˯Á¤¤·j´M ºô¸ô³s½u
 
 §@·~¨t²Î Windows NT ¥B ºô¸ôIP ¬O¯B°ÊIP
 ½Æ»s¥N½XSub ½m²ß()
    Dim motoSht As Worksheet, sakiSht As Worksheet, sakiRng As Range
    Dim motoHani()                                     '«Å§iÅܼÆ
    Set motoSht = Worksheets("°]°È¤ÀªR")               '³]©wÓ§O°]°È¤ÀªR¤u§@ªí
    Set sakiSht = Worksheets("¤W¥«")                             '³]©wÀx¦s¥þ³¡¤W¥«¤u§@ªí
    motoSht.Range("A1:T21") = ""
    For Each E In motoSht.Names                             ' §R°£ QueryTables 
        E.Delete
    Next
    '±N·QnÂà¼g¤§Àx¦s®æªº¦ì¸mÀx¦s¦b°}¦C¤¤
    motoHani = Array("C18", "D18", "E18", "H18", "I18", "J18", "M18", "N18", "O18", "T18")
    '¨ú±o¤ÀªRµ²ªG¦Ü¤W¥«Á`ªíªº¿é¤J¦ì¸m
    motoaddress = Array("A1", "f1", "k1", "p1")
    motoyear = Array(93, 96, 99, 100)
    '¨ú±o¸ü¤J°]°È¤ÀªR¤Î¦~«×¸ê®Æ¦ì¸m
    motoRowcon = sakiSht.Range("a1").CurrentRegion.Rows.Count
    '¨ú±o¤W¥«Á`¦C¼Æ
    For i = 2 To motoRowcon
        motoSht.Cells(25, 1) = sakiSht.Cells(i, 1)
        For x = 0 To 3
RE:
        Application.StatusBar = False
    With motoSht.QueryTables.Add(Connection:= _
        "URL;http://mopsov.twse.com.tw/server-java/t05st22?colorchg=1&off=1&TYPEK=sii&isnew=false&year=" & motoyear(x) & "&co_id=" & motoSht.Range("A25") & "&" _
        , Destination:=motoSht.Range(motoaddress(x)))
        .Name = _
        "t05st22?colorchg=1&off=1&TYPEK=sii&isnew=false&year=100&co_id=1733&"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "4"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
       .Refresh BackgroundQuery:=False
       If Application.Count(.ResultRange) = 0 Then   '¨ì²Ä¤E®a¹L«á´NÅܪºªÅ¥Õ
            Application.StatusBar = "µ¥Ôºô¶¤¤...."
            «±Ò³s½u
            GoTo RE
        End If
    End With
    Next
    For j = 0 To UBound(motoHani)
        sakiSht.Cells(i, 25).Offset(0, j).Value = motoSht.Range(motoHani(j)).Value
    Next
    motoSht.Range("A1:T21") = ""
    For Each E In motoSht.Names
        E.Delete
    Next
Next
'±NÓ§O¸ê®Æ±a¤J¤W¥«Á`ªí
MsgBox "¿é¤J§¹²¦¡C"
End Sub
Sub «±Ò³s½u()
   ' ¦¹µ{¦¡§@¥Î:¤¤Â_ºô¸ô³s½u¦A«×³s½u«·s¨úªººô¸ôIP,¥H«·s¨ú±o WEB SERVER¨î ¤@¤ÀÄÁŪ¨ú20¦¸
    'ºô¸ô³s½u ªº¦WºÙ adsl ½Ðקאּ §APC ¤W¥¿½T¦WºÙ
    'res = Shell("rasphone.exe [-d *****]", 1)
    res = Shell("rasphone.exe [-d adsl]", 1)
    AppActivate res, True
    SendKeys "%(U)", True
    Application.Wait Now + #12:00:01 AM# '©µ¿ðµ¥Ôµ{¦¡³B¸Ì
  
    SendKeys "%(Y)", True
    Application.Wait Now + #12:00:01 AM#   '©µ¿ðµ¥Ôµ{¦¡³B¸Ì
  
    SendKeys "%(C)", True
    Application.Wait Now + #12:00:01 AM#   '©µ¿ðµ¥Ôµ{¦¡³B¸Ì
  
    SendKeys "%(C)", True
    Application.Wait Now + #12:00:02 AM#      '©µ¿ðµ¥Ô¦±µ{¦¡³B¸Ì
End Sub
 | 
 |