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

Ãö©óµ{¦¡½X³o¤@¬q½Ð°Ý¦³¤H·|§ï¶Ü?

Ãö©óµ{¦¡½X³o¤@¬q½Ð°Ý¦³¤H·|§ï¶Ü?

³o­Óvba§Ú¬O·Q©ñ¦b §Úªº "¤W¥«¤T¤jªk¤H¶R½æ¶W"¤À­¶  , ¥i¥H«ü©w¤U¸ü¨ì³o¤@­Ó¤À­¶
¸Ó«ç»ò­×§ï¤j¤jµ¹ªºµ{¦¡½X©O?

Option Explicit
Sub EX()
    Dim xDate As Date, genpage As String, qdate As String, Print_php As String, Wb As Workbook
   
    '1 ¦p¤£¥i¬d¸ß·í¤é ¤T¤jªk¤H¶R½æ¶W¤é³ø
    xDate = Date - 1
   
   
    Do While Weekday(xDate, vbMonday) >= 6
        xDate = xDate - 1
    Loop
   
    '¦p©ó¤@©wªº®É¶¡«á¥i¬d¸ß·í¤éªº ¤T¤jªk¤H¶R½æ¶W¤é³ø
    '½Ð§R°£ ** xDate = Date - 1 **
   
   
    '2 °õ¦æ¤U­±ªºµ{¦¡½X,¨ú®øµù¸Ñ ** ' **
   
    'If xDate = Date And Time < #5:00:00 PM# Then
    '    xDate = xDate - 1
    'End If
   
    For Each Wb In Workbooks
        If Trim(Wb.Name) = "print.php" Then Wb.Close False
        '¤U¸üCSV ªº¦WºÙ¬° Print_php ¥²¥ýÃö³¬
    Next
    genpage = Format(xDate, "yyyymm/yyyymmdd")
    qdate = Format(xDate, "yyyymmdd")
    Print_php = "http://www.twse.com.tw/ch/trading/fund/T86/print.php?edition=ch&filename=genpage/" _
             & genpage & "_2by_issue.dat&type=csv&select2=ALLBUT0999&qdate=" & qdate

     Set Wb = Workbooks.Open(Print_php)
End Sub

¦^´_ 1# vavashop
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub EX()
  3.     Dim xDate As Date, genpage As String, qdate As String, Print_php As String, Wb(1 To 2) As Workbook
  4.     Set Wb(1) = Workbooks("¤W¥«¤T¤jªk¤H¶R½æ¶W") ' "¤W¥«¤T¤jªk¤H¶R½æ¶W"¤À­¶
  5.    
  6.     '***¤T¤jªk¤H¶R½æ¶W¤é³ø    À°§A¬d¸ß¹L,
  7.     '[Àç·~®É¶¡¤º]¥u¯à¬d¬Ý«e¤@­ÓÀç·~¤éªº³øªí.
  8.     '©Ò¥H [Àç·~®É¶¡¤º] ¬d¸ß¤é : xDate = Date - 1
  9.     xDate = Date
  10.     If Time < #2:00:00 PM# Then  '[Àç·~®É¶¡¤º] **
  11.         Do While Weekday(xDate, vbMonday) = 1 Or Weekday(xDate, vbMonday) >= 6  '±Æ°£ ¶g¤é,¶g¤»,¶g¤@
  12.             xDate = xDate - 1
  13.         Loop
  14.     ElseIf Time > #2:00:00 PM# Then  '[Àç·~®É¶¡«á] ½Ð½Õ¾ã:¥xÃÒ¥æ©ö©Ò¸ê®Æ¾ã²z§¹²¦ªº®É¶¡
  15.         Do While Weekday(xDate, vbMonday) >= 6  '±Æ°£ ¶g¤é,¶g¤»
  16.             xDate = xDate - 1
  17.         Loop
  18.     End If
  19.     For Each Wb(2) In Workbooks
  20.         If Trim(Wb(2).Name) = "print.php" Then Wb(2).Close False     '¤U¸üCSV ªº¦WºÙ¬° Print_php ¥²¥ýÃö³¬
  21.     Next
  22.     genpage = Format(xDate, "yyyymm/yyyymmdd")
  23.     qdate = Format(xDate, "yyyymmdd")
  24.     Print_php = "http://www.twse.com.tw/ch/trading/fund/T86/print.php?edition=ch&filename=genpage/" _
  25.              & genpage & "_2by_issue.dat&type=csv&select2=ALLBUT0999&qdate=" & qdate

  26.      Set Wb(2) = Workbooks.Open(Print_php)
  27.      Wb(2).Sheets(1).Copy Wb(1).Sheets(1)
  28. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ÁÂÁ¤j¤j~~

¸÷«ô¸÷«ô

TOP

Set Sh = Sheets.Add         '·s¼Wªº¤u§@ªí
    Rng.AutoFilter 1, "A"       '*** ½Ð­×§ï§Aªº¦Û°Ê¿z¿ï ±ø¥ó ***
    With Sh '·s¼Wªº¤u§@ªí
        Rng.Copy .[A1]          '½Æ»s ¤w¦Û°Ê¿z¿ïªº½d³ò

¤j¤j§Ú¦b·s¼W¤u§@ªí«á­n§ì¨ú ­¶­±ªº³¡¥÷ÁÙ¬O·|¦³°ÝÃD
¥i¥Hª½±µ¦³©Ò¿× §ì¾ã­Óexcel ­¶­±ªº ¤è¦¡¶Ü?
¦]¬°§Úªº¤ñ¨Ò³£¬O©T©wªº ´N¬O­¶­±©ç·Ó³o¼Ë

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤H¤£©È¿ù¡A´N©È¤£§ï¹L¡A§ï¹L¨Ã¤£Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD