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

[µo°Ý] ¥i§_¥Î°j°é©ÎÅܼƶפJ¤j¶q¸ê®Æ¡H

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-26 15:42 ½s¿è

¦^´_ 26# smart3135
¤j¬ù­n¯Ó®É40¤ÀÄÁ¥H¤W,¬O¦³ÂI¤[,¹q¸£­n´îªÎ¤F
«Øij´îªÎ¤è¦¡¦p¤U
1±N¤U­±¤å¦r½Æ»s¨ì°O¨Æ¥»  ¦sÀɬ°ªþÀɦW ".BAT",¶Ç°e¨ì®à­±¤W ,¤£©w®Éªº²M²z©U§£ÀÉ®×
2¤£©w®Éªº²MªÅ¸ê·½¦^¦¬µ©
3 ¤£©w®É²MªÅIEªºÂsÄý°O¿ý
4 ©w®Éªº²M²zºÏºÐ
5ÂX¥R°O¾ÐÅé

4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~ªºªÑ²¼¸¹½X,³o¨ÇªÑ²¼¦WºÙ(¥N¸¹) ³sÄò¤@°_¿é¤J¦bSheets(2)ªºAÄæ
  1. Option Explicit
  2. Sub §ì©u¤ëÀ禬¸ê®Æ()
  3.     Dim E As Integer, URL As String, xPath As String, xFile As String
  4.     Dim i As Integer, ii As Integer, Rng As Range, S1 As String, S2 As String, t As Date
  5.     Dim AR()
  6.     t = Time
  7.     AR = Array(4203) '¿é¤J 4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~ªºªÑ²¼¸¹½X
  8.     URL = "URL;https://djinfo.cathaysec.com.tw/Z/ZC/ZCH/ZCH.DJHTM?A="
  9.     xPath = "D:\°]³ø¸ê®Æ"
  10.     With ThisWorkbook
  11.         .Sheets(2).UsedRange.Offset(, 1).Clear
  12.         '4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~ªºªÑ²¼¸¹½X ³o¨Ç ªÑ²¼¦WºÙ(¥N¸¹) ³sÄò¤@°_¿é¤J¦bSheets(2)ªºAÄæ
  13.         Set Rng = .Sheets(2).Range("A:A").SpecialCells(xlCellTypeConstants)
  14.         If Rng Is Nothing Then
  15.             AR = Array()
  16.         ElseIf Rng.Count = 1 Then
  17.             AR = Array(Rng.Value)
  18.         Else
  19.             AR = Application.Transpose(Application.Transpose(Rng))
  20.         End If        '***************************************************
  21.         Application.ScreenUpdating = False
  22.         Application.StatusBar = " "
  23.         With .Sheets(1)      '¬¡­¶Ã¯ªº²Ä 1 ±i¤u§@ªí
  24.             If .QueryTables.Count = 0 Then
  25.                 With .QueryTables.Add(Connection:=URL, Destination:=.Range("$A$1"))
  26.                     .Refresh BackgroundQuery:=False
  27.                 End With
  28.             End If
  29.                 .Rows(1).Delete
  30.                 .Columns(1).Delete
  31.             For E = 1101 To 5000
  32.                 With .QueryTables(1)
  33.                     .Connection = URL & E
  34.                     .PreserveFormatting = True
  35.                     .BackgroundQuery = True
  36.                     .RefreshStyle = xlInsertDeleteCells
  37.                     .SaveData = True
  38.                     .AdjustColumnWidth = True
  39.                     .RefreshPeriod = 0
  40.                     .WebSelectionType = xlSpecifiedTables
  41.                     .WebFormatting = xlWebFormattingNone
  42.                     .WebTables = "3"
  43.                     .WebPreFormattedTextToColumns = True
  44.                     .WebConsecutiveDelimitersAsOne = True
  45.                     .Refresh BackgroundQuery:=False
  46.                     If .ResultRange(1) < 0 Or InStr(.ResultRange(2, 1), "¬dµL") Then GoTo xLnext
  47.                     '¶×¤J¸ê®Æªº A1 < 0  OR  ¶×¤J¸ê®Æªº A2 "¬dµL"
  48.                     S1 = .ResultRange(1)
  49.                     S2 = Mid(S1, 1, InStr(S1, "(") - 1) 'ªÑ²¼¦WºÙ
  50.                 End With
  51.                 With ThisWorkbook.Sheets(2).Range("B:B")
  52.                     Set Rng = .Find(S2, lookat:=xlPart) '·j´M:ªÑ²¼¦WºÙ
  53.                     If Rng Is Nothing Then
  54.                         i = i + 1
  55.                         .Range("A" & i) = S1  'ªÑ²¼¦WºÙ¥N½X
  56.                     Else
  57.                         Rng.Cells(1, 2) = S1   '­«½ÆªºªÑ²¼
  58.                         If UBound(Filter(AR, E)) > -1 And UBound(AR) > -1 Then
  59.                         'Filter(AR, E) > -1   '¤ñ¹ï¨ì¦p4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~
  60.                             Rng.Cells(1, 2) = Rng.Cells(1, 2) & "***" '«á§ì¨ú¬O¿ù»~
  61.                             GoTo xLnext:
  62.                         End If
  63.                         S2 = Mid(Trim(Rng), InStr(Trim(Rng), "(") + 1)
  64.                         S2 = Mid(S2, 1, Len(S2) - 1)    'ªºªÑ²¼[¥N½X]
  65.                         xFile = xPath & "\" & S2 & "\*.*" '±þ±¼©Ò¦³ÀÉ®×
  66.                         If Dir(xFile) <> "" Then
  67.                             ii = ii - 1
  68.                             Kill xFile
  69.                             xFile = xPath & "\" & S2
  70.                             If Dir(xFile, vbDirectory) <> "" Then RmDir xFile '¸ê®Æ§¨¤]§R°£¤F
  71.                         End If
  72.                     End If
  73.                 End With
  74.                 ii = ii + 1
  75.                 xFile = xPath & "\" & E & "\REVENUE.txt"
  76.                 MkDir_Sub xFile
  77.                 Maketxt xFile, .QueryTables(1)
  78. xLnext:
  79.                 S1 = " " & Sheets(1).QueryTables(1).ResultRange(1)
  80.                 If Val(S1) < 0 Then S1 = " ¬dµL"
  81.                 Application.StatusBar = Application.Text(Time - t, ["MM¤ÀSS¬í"]) & "  " & E & S1
  82.             Next
  83.         End With
  84.     End With
  85.     Application.ScreenUpdating = True
  86.     Application.StatusBar = Application.Text(Time - t, ["MM¤ÀSS¬í"]) & " Ok "
  87.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.Text(Time - t, ["MM¤ÀSS¬í"])
  88. End Sub
  89. Private Sub Maketxt(xF As String, Q As QueryTable)   '±N¶×¤J¸ê®Æ¦s¤J«ü©wªºtxt
  90.     Dim fs As Object, E As Range, C As Variant
  91.     Set fs = CreateObject("Scripting.FileSystemObject")
  92.     Set fs = fs.CreateTextFile(xF, True)  '³Ð¨£¤@­ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
  93.     For Each E In Q.ResultRange.Rows
  94.         C = Application.Transpose(Application.Transpose(E.Value))
  95.         C = Join(C, vbTab)
  96.         fs.WriteLine C
  97.     Next
  98.     fs.Close
  99. End Sub
½Æ»s¥N½X

EX.JPG (136.56 KB)

EX.JPG

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-26 15:52 ½s¿è

¦^´_ 29# smart3135
1233¤Ñ¤¯(¥ý§ì¨ú)¬O¥¿½Tªº¡A4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~ªº°ÝÃD
³o¤@¨Ç¿ù»~ªÑ²¼¦WºÙ(¥N¸¹) ¤Ñ¤¯(4203) ³sÄò¤@°_¿é¤J¦bSheets(2)ªºAÄæ,«áµ{¦¡¥i¸Ñ¨M.

28# ªº©Ò¦³°ÝÃD.27#µ{¦¡½X¤w§ó·s¤F,¥i¦A¬Ý¤@¦¸,´îªÎ¦³¸Õ¤@¤U¶Ü?

¸Õ¸Õ¬Ý
  1. Sub Ex()
  2.     Dim E As Integer
  3.     For E = 500 To 5000
  4.         Select Case E
  5.             Case 500 To 1000
  6.                 GoTo xNext
  7.             Case 1500 To 2000
  8.                 GoTo xNext
  9.             Case 2500 To 3000
  10.                 GoTo xNext
  11.         End Select
  12.         MsgBox E
  13. xNext:
  14.     Next
  15. End Sub
  16. Sub Ex1()
  17.     Dim E As Integer
  18.     For E = 500 To 5000
  19.         If E >= 500 And E <= 1000 Or E >= 1500 And E <= 2000 Or E >= 2500 And E <= 3000 Then
  20.                 GoTo xNext
  21.         End If
  22.         MsgBox E
  23. xNext:
  24.     Next
  25. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-26 20:22 ½s¿è

¦^´_ 31# smart3135
³o­ÓBATÀɧڤ@ª½³£¦³¦b¥Î¡A¬O§_¨C¦¸°õ¦æ§¹VBA´N­n²M¤@¦¸©O¡H,§A­n¶]³oµ{¦¡·íµM³Ì¦n¬Oªº,Àɮ׶}¶}ÃöÃö·|»s³y¤@¨Ç¼È¦sÀÉ,´N»Ý­n²M¤@¤U
WIN7 64¦ì¤¸+office 2007¡A°O¾ÐÅé¬O4G¡A¬O¤£»ÝÂX¥R¤F,¥t´N´N¶}¾÷®É¨t²Î­n¸ü¤Ó¤Jªº±`¾nÀ³¥Îµ{¦¡.¦û¾Ú¤Ó¦hªº°O¾ÐÅé.³o¤]¬O¥D¦]¤§£¸.
XP,32¦ì¤¸, 1GB, 2003ª©, 27#µ{¦¡ For 1101 To 5000ªº°j°é ,´îªÎ«á7¤ÀÄÁ¤º·d©w.
Eªº°Ï¶¡³]©w¶V¤p¡A§¹¦¨ªº®É¶¡´N¶Vµu¡A³o³¡¤À´N¤£¤Ó²z¸Ñ¬°¤°»ò·|³o¼Ë¤F,³o¬O·Q·íµMªº
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Ar
  4.     Ar = Array(56, 78, _
  5.          9, 10, 12 _
  6.        , 888, 999, _
  7.        56789)
  8. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-27 15:24 ½s¿è

¦^´_ 34# smart3135
  1. Option Explicit
  2. Private Sub Test()
  3.     Dim fs As Object, E As Range, C As Variant
  4.     Set fs = CreateObject("Scripting.FileSystemObject")
  5.     Set fs = fs.CreateTextFile("D:\°]³ø¸ê®Æ\1101\Test.TXT", True)
  6.     '³Ð¨£¤@­ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
  7.     '¤å¦rÀɪº¼g¤J¬O
  8.     For Each E In Sheets(1).UsedRange.Columns
  9.         C = E.Value  '-> °}¦C(1 To ¦C¼Æ,1 To øó¼Æ)ªº¤Gºû°}¦C
  10.         C = Application.Transpose(E.Value) '¦]¬°²Ä¤Gºû¥u¦³¤@Äæ,Âà¸m¤@¦¸¥iÅܬ°¤@ºû°}¦C
  11.        '¦pE In UsedRange.rows
  12.        'C = E.Value  '-> °}¦C(1 To ¦C¼Æ,1 To øó¼Æ)ªº¤Gºû°}¦C
  13.        'C = Application.Transpose(Application.Transpose(E.Value)) '²Ä¤Gºû¤£¥u¤@Äæ,©Ò¥HÂà¸m¤G¦¸¤~¥iÅܬ°¤@ºû°}¦C
  14.         C = Join(C, vbTab)
  15.         'Join ¨ç¼Æ ¶Ç¦^¤@­Ó¦r¦ê¡A¸Ó¦r¦ê¬O³z¹L³sµ²¬Y­Ó°}¦C¤¤ªº¦h­Ó¤l¦r¦ê¦Ó«Ø¥ßªº¡C
  16.         'Join ¨ç¼Æ ¨Ï¥Îªº°}¦C¥²¶·¬O¤@ºû°}¦C
  17.         fs.WriteLine C
  18.     Next
  19.     fs.Close
  20. End Sub
½Æ»s¥N½X



¸Ô¬Ýµù¸Ñ¥i©úÁA.

  1. Option Explicit
  2. Sub §ì©u¤ëÀ禬¸ê®Æ()
  3.     Dim E As Integer, URL As String, xPath As String, xFile As String
  4.     Dim i As Integer, ii As Integer, Rng As Range, S1 As String, S2 As String, t As Date
  5.     Dim AR()
  6.     t = Time
  7.     URL = "URL;https://djinfo.cathaysec.com.tw/Z/ZC/ZCH/ZCH.DJHTM?A="
  8.     xPath = "D:\°]³ø¸ê®Æ"
  9.     Application.DisplayStatusBar = True
  10.     With ThisWorkbook
  11.         '¨âªÌ¨ú¤@§Y¥i (¿ï¾ÜÀx¦s®æ¸û¤è«K)
  12.         '***'¤£»Ý­nªºªÑ²¼¦p4203¤Ñ¤¯(«á§ì¨ú)¬O¿ù»~ªºªÑ²¼¸¹½X ¸m¤J-> Ar°}¦C
  13.    ' AR = Array(1202, 1420, 1433, 1502, 1518, 1610, 1716, 2346, 2372, 2391, 2513, 2526, 2541, 2802, 2803, 2804, 2806, _
  14.             2813, 2814, 2815, 2817, 2818, 2819, 2821, 2826, 2830, 2839, 2840, 2843, 2844, 2848, 2907, 2909, 4101, 4112, _
  15.             4175, 4201, 4203, 4204, 4301, 4302, 4405, 4407, 4409, 4410, 4411, 4412, 4504, 4505, 4507, 4508, 4509, 4512, _
  16.             4514, 4516, 4517, 4519, 4520, 4521, 4524, 4525, 4531, 4603, 4604, 4605, 4606, 4607, 4608, 4701, 4704, 4705, _
  17.             4708, 4709, 4710, 4713, 4715, 4718, 4901, 4902, 5001, 5003, 5004, 5005, 5012, 5101, 5311, 5319, 5320, 5322, _
  18.             5323, 5327, 5330, 5331, 5334, 5335, 5337, 5341, 5342, 5354, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5366, _
  19.             5368, 5369, 5374, 5377, 5379, 5380, 5382, 5389, 5391, 5393, 5394, 5396, 5397, 5399, 5404, 5405, 5408, 5409, _
  20.             5411, 5412, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5427, 5428, 5430, 5431, 5433, 5435, _
  21.             5440, 5444, 5445, 5446, 5447, 5449, 5453, 5456, 5458, 5459, 5461, 5462, 5463, 5470, 5472, 5476, 5477, 5482, _
  22.             5485, 5486, 5495, 5496, 5499, 5509, 5517, 5527, 5606, 5705, 5804, 5805, 5806, 5807, 5809, 5812, 5814, 5815, _
  23.             5854, 6003, 6006, 6019, 6102, 6106, 6401, 6501, 8001, 8003, 8903, 8904, 8912, 8914, 8915, 8918, 8920, 8922, 8939, 9105, 9909)
  24.             
  25.         '***AÄ椤¤£»Ý­nªºªÑ²¼ ¦p4203¤Ñ¤¯(«á§ì¨ú)¸¹½XªºÀx¦s®æ  ¸m¤J-> Ar°}¦C
  26.         Set Rng = .Sheets(2).Range("A:A").SpecialCells(xlCellTypeConstants)
  27.         If Rng Is Nothing Then
  28.             AR = Array()
  29.         ElseIf Rng.Count = 1 Then
  30.             AR = Array(Rng.Value)
  31.         Else
  32.             AR = Application.Transpose(Rng.Value)
  33.             
  34.             '¥ý«e¥X¿ù¬O³o¸Ì¼g¿ù AR = Application.Transpose(Application.Transpose(Rng.Value))
  35.             'Rng.Value=>³æÄæ¤Gºû°}¦C
  36.         End If
  37.         '***************************************************
  38.         .Sheets(2).UsedRange.Offset(, 1).Clear
  39.         Application.ScreenUpdating = False
  40.         Application.StatusBar = " "
  41.         With .Sheets(1)      '¬¡­¶Ã¯ªº²Ä 1 ±i¤u§@ªí
  42.             If .QueryTables.Count = 0 Then
  43.                 With .QueryTables.Add(Connection:=URL, Destination:=.Range("$A$1"))
  44.                     .Refresh BackgroundQuery:=False
  45.                 End With
  46.             End If
  47.             .Rows(1).Delete
  48.             .Columns(1).Delete
  49.             For E = 1101 To 5000
  50.                 If UBound(Filter(AR, E)) > -1 Then GoTo xLnext
  51.                 'Filter(AR, E)¨ç¼Æ µ¥¦P¨Ï¥ÎFind¤èªk ¦p Set Rng = .Find(S2, lookat:=xlPart) '·j´M:ªÑ²¼¦WºÙ
  52.                 With .QueryTables(1)
  53.                     .Connection = URL & E
  54.                     .PreserveFormatting = True
  55.                     .BackgroundQuery = True
  56.                     .RefreshStyle = xlInsertDeleteCells
  57.                     .SaveData = True
  58.                     .AdjustColumnWidth = True
  59.                     .RefreshPeriod = 0
  60.                     .WebSelectionType = xlSpecifiedTables
  61.                     .WebFormatting = xlWebFormattingNone
  62.                     .WebTables = "3"
  63.                     .WebPreFormattedTextToColumns = True
  64.                     .WebConsecutiveDelimitersAsOne = True
  65.                     .Refresh BackgroundQuery:=False
  66.                     If InStr(.ResultRange(2, 1), "¬dµL") Then      '¬dµL³oÀɪѲ¼
  67.                         Mark_Code E                                '¬dµLªºªÑ²¼ ©ñ¸mAÄd
  68.                         GoTo xLnext
  69.                     End If
  70.                     S1 = .ResultRange(1)                '¶×¤J¸ê®Æªº²Ä1­ÓÀx¦s®æ
  71.                     S2 = Mid(S1, 1, InStr(S1, "(") - 1) 'ªÑ²¼¦WºÙ
  72.                 End With
  73.                
  74.                 With ThisWorkbook.Sheets(2).Range("B:B")
  75.                     Set Rng = .Find(S2, lookat:=xlPart) '·j´M:ªÑ²¼¦WºÙ
  76.                     If Rng Is Nothing Then
  77.                         i = i + 1
  78.                         .Range("A" & i) = S1  'ªÑ²¼¦WºÙ¥N½X
  79.                     Else
  80.                        Mark_Code E '­«½ÆªºªÑ²¼ ©ñ¸mAÄd
  81.                         S2 = Mid(Trim(Rng), InStr(Trim(Rng), "(") + 1)
  82.                         S2 = Mid(S2, 1, Len(S2) - 1)    'ªºªÑ²¼[¥N½X]
  83.                         xFile = xPath & "\" & S2 & "\*.*" '±þ±¼©Ò¦³ÀÉ®×
  84.                         If Dir(xFile) <> "" Then
  85.                             ii = ii - 1
  86.                             Kill xFile
  87.                             xFile = xPath & "\" & S2
  88.                             If Dir(xFile, vbDirectory) <> "" Then RmDir xFile '¸ê®Æ§¨¤]§R°£¤F
  89.                         End If
  90.                     End If
  91.                 End With
  92.                 ii = ii + 1
  93.                 xFile = xPath & "\" & E & "\REVENUE.txt"
  94.                 MkDir_Sub xFile
  95.                 Maketxt xFile, .QueryTables(1)
  96. xLnext:
  97.                 S1 = " " & Sheets(1).QueryTables(1).ResultRange(1)
  98.                 If Val(S1) < 0 Then S1 = " ¬dµL"
  99.                 Application.StatusBar = Application.text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J " & ii & " ¤å¦rÀÉ,  Åª¨ú " & S1 & " ¤¤..."
  100.             Next
  101.         End With
  102.     End With
  103.     Application.ScreenUpdating = True
  104.     Application.StatusBar = Application.text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J " & ii & " ¤å¦rÀÉ,  Åª¨ú§¹²¦ !! "
  105.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.text(Time - t, ["MM¤ÀSS¬í"])
  106.     ThisWorkbook.Save
  107. End Sub
½Æ»s¥N½X
  1. Private Sub Mark_Code(S As Integer)
  2.     With ThisWorkbook.Sheets(2).Range("A:A") '­«½ÆªºªÑ²¼ ©ñ¸mAÄd
  3.         .Cells(Application.Count(.Cells) + 1, "A") = S
  4.         'ªÑ²¼¥N¸¹©ñ¸m AÄd³Ì«á¤@­ÓÀx¦s®æ
  5.         '°õ¦æ¤@¦¸«á,¤U¦¸¦A°õ¦æ [§ì©u¤ëÀ禬¸ê®Æ]µ{¦¡®É,For °j°é¤¤¥i½ð°£³oªÑ²¼¥N¸¹
  6.     End With
  7. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 37# smart3135
¥ý¦^ÂФWÂd¤ë¦¨¥æ¸ê°T,¨Æ±¡¦£§¹¦AÄ~Äò¦^ÂЧA
  1. Option Explicit
  2. Dim IE As Object
  3. Sub IE_Application()
  4.     Set IE = CreateObject("InternetExplorer.Application")
  5.     With IE
  6.         .Navigate "http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.php"
  7.      '   .Visible = True   '¤£Åã¥Üie
  8.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  9.   End With
  10. End Sub
  11. Sub ¤WÂd¤ë¦¨¥æ¸ê°T()
  12.     Dim E As Range, xPath As String, xFile As String, A As Object, FS As Object, F As Object
  13.     Dim i As Integer, ii As Integer, t As Date, AR(), Rng As Range, r, c, s
  14.     Set FS = CreateObject("Scripting.FileSystemObject")
  15.     Ie_Url = "http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.php"
  16.     t = Time
  17.     Application.DisplayStatusBar = True
  18.     '½Ð±N¤WÂdªºªÑ²¼¥N¸¹,¦b Sheets(3).Range("A1")©¹¤UKey¤W,°j°é¨Ì³o¸ÌªºªÑ²¼¥N¸¹¶×¤J
  19.     Set Rng = ThisWorkbook.Sheets(3).Range("A:A")
  20.     If Application.Count(Rng) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  21.     Set Rng = Rng.SpecialCells(xlCellTypeConstants)
  22.     xPath = "D:\°]³ø¸ê®Æ"
  23.     IE_Application    '
  24.     Application.StatusBar = " "
  25.     For Each E In Rng
  26.         With IE
  27.             Set A = .Document.getelementbyid("input_stock_code")
  28.             A.Value = E
  29.             A.ParentNode.submit
  30.             Do While .Busy Or .ReadyState <> 4:    Loop
  31.             Set A = .Document.getelementsbytagname("TABLE")
  32.             xFile = xPath & "\" & E & "\¤WÂd¤ë¦¨¥æ.txt"
  33.             MkDir_Sub xFile
  34.             With FS.CreateTextFile(xFile, True)
  35.                 For i = 1 To A(2).Rows.Length - 1
  36.                     s = ""
  37.                     For c = 0 To A(2).Rows(i).Cells.Length - 1
  38.                         s = s & A(2).Rows(i).Cells(c).innertext & vbTab
  39.                     Next
  40.                     .WriteLine s
  41.                 Next
  42.                 .Close
  43.             End With
  44.             ii = ii + 1
  45.         End With
  46.         Application.StatusBar = Application.text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ"
  47.     Next
  48.     IE.Quit
  49.     Application.StatusBar = Application.text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ,  Åª¨ú§¹²¦ !! "
  50.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.text(Time - t, ["MM¤ÀSS¬í"])
  51.     ThisWorkbook.Save
  52. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 39# smart3135
¶]¤@­Ó¤å¦rÀɪº®É¶¡¤j¬ù­n4-5¬í¡A½T©w¦³²M²z¨t²Î¤F¡A¤£¹LÁÙ¬O«D±`ºC ?
¥i¯à¬O¶V¦Ñªºª©¥»³t«×¶V§Ö,¸Õ¸Õ2003ª©¬Ý¬Ý
¥t¥~¦³¿ìªk¹³¤§«e±N¶×¤J¸ê®ÆÅã¥Ü¦bEXCEL¥H«K³v¦æ°õ¦æ®É¥i¥H¬Ý¥XEXCEL¦p¦óÅܤơA¦p¦¹³t«×§óºC¤F.

  1. Option Explicit
  2. Sub ¶°«O¤áªÑÅv_WEB_»s¹Ï()
  3.     Dim WB As Workbook, Rng As Range
  4.     Dim Ar(), A, i As Integer, strDate As String, stkno As String, Qur As String
  5.     With CreateObject("InternetExplorer.Application")
  6.         .Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
  7.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  8.         Set A = .document.All.tags("option") '¸ê®Æ¤é´Áªº¤º®e
  9.         ReDim Ar(A.Length - 1)
  10.         For i = 0 To A.Length - 1
  11.             Ar(i) = A(i).innerHTML
  12.         Next
  13.         .Quit
  14.     End With
  15.     Set WB = Workbooks.Add
  16.     With WB
  17.         .Sheets(1).Name = "¹Ïªí"
  18.         .Sheets(2).Name = "¸ê®Æ®w"
  19.     End With
  20.     stkno = InputBox("¿é¤JªÑ²¼¥N¸¹", "ªÑ²¼¥N¸¹", 2317)    '
  21.     If stkno = "" Or Len(stkno) <> 4 Or Val(stkno) = 0 Then MsgBox "ªÑ²¼¥N¸¹"
  22.     For i = 0 To UBound(Ar)
  23.         strDate = Ar(i)  '¾É¤J¤ë¥÷
  24.         Qur = "http://www.tdcc.com.tw/smWeb/QryStock.jsp?SCA_DATE=" & strDate & "&SqlMethod=StockNo&StockNo=" & stkno & "&StockName=&sub=%ACd%B8%DF"          '
  25.         With WB.Sheets(3)
  26.             If .QueryTables.Count = 0 Then
  27.                 .QueryTables.Add "URL;" & Qur, .[A1]
  28.             Else
  29.                 .QueryTables(1).Connection = "URL;" & Qur
  30.             End If
  31.             With .QueryTables(1)
  32.                 .WebSelectionType = xlSpecifiedTables
  33.                 .WebFormatting = xlWebFormattingNone
  34.                 .WebTables = "6,7,8"
  35.                 .WebPreFormattedTextToColumns = True
  36.                 .WebConsecutiveDelimitersAsOne = True
  37.                 .WebSingleBlockTextImport = False
  38.                 .WebDisableDateRecognition = False
  39.                 .WebDisableRedirections = False
  40.                 .Refresh BackgroundQuery:=False
  41.                 If Application.Count(.ResultRange) = 0 Then
  42.                     MsgBox "ªÑ²¼¥N¸¹ " & stkno & " ¿ù»~"
  43.                     WB.Close , False
  44.                     Exit Sub
  45.                 End If
  46.                 If i = 0 Then WB.Sheets(2).Cells(2, i + 1).Resize(15) = .ResultRange.Range("B6").Resize(15).Value
  47.                 WB.Sheets(2).Cells(1, i + 2) = Mid(.ResultRange.Range("A3"), 6)
  48.                 WB.Sheets(2).Cells(2, i + 2).Resize(15) = .ResultRange.Range("E6").Resize(15).Value
  49.             End With
  50.         End With
  51.     Next
  52.     With WB
  53.       Set Rng = .Sheets(2).UsedRange
  54.        With .Sheets(1)
  55.             With .ChartObjects.Add(.[B3].Left, .[B3].Top, .[B3].Resize(, 15).Width, .[B3].Resize(25).Height).Chart
  56.                 .ChartType = xlLineMarkers
  57.                 .SetSourceData Rng, xlRows
  58.                 .SeriesCollection(13).AxisGroup = 2
  59.                 .HasTitle = True
  60.                 .ChartTitle.Characters.Text = WB.Sheets(3).[A1]
  61.                 .PlotArea.Interior.ColorIndex = 23
  62.             End With
  63.         End With
  64.         .Activate
  65.     End With
  66. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-30 10:30 ½s¿è

¦^´_ 42# smart3135
WEB ¬d¸ß½Ð ª©¤W¦³³\¦h°Q½× ¥i·j´M http://www.twse.com.tw/ch/trading/exchange/FMNPTK/FMNPTKMAIN.php  ³o¦r¦ê
¤W¥«»P ¤WÂd ºô­¶ªº«Ø¸m¤£¦P
  1. Option Explicit
  2. Dim IE As Object
  3. Sub IE_Application()
  4.     Set IE = CreateObject("InternetExplorer.Application")
  5.     With IE
  6.         .Navigate "http://www.twse.com.tw/ch/trading/exchange/FMNPTK/FMNPTKMAIN.php"
  7.         .Visible = True   'Åã¥Üie
  8.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  9.   End With
  10. End Sub
  11. Sub ¤W¥«¦~¦¨¥æ¸ê°T()
  12.     Dim E As Range, xPath As String, xFile As String, A As Object, fs As Object, F As Object, IE_URL As String
  13.     Dim i As Integer, ii As Integer, t As Date, AR(), Rng As Range, r, C, S
  14.     Set fs = CreateObject("Scripting.FileSystemObject")
  15.     IE_URL = "http://www.twse.com.tw/ch/trading/exchange/FMNPTK/FMNPTKMAIN.php"
  16.     t = Time
  17.     Application.DisplayStatusBar = True
  18.     Set Rng = ThisWorkbook.Sheets(3).Range("A:A")
  19.     If Application.Count(Rng) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  20.     Set Rng = Rng.SpecialCells(xlCellTypeConstants)
  21.     '§A¤w±N¤W¥«ªºªÑ²¼¥N¸¹,¦bSheets(3).Range("A1")©¹¤UKey¤W,°j°é¨Ì³o¸ÌªºªÑ²¼¥N¸¹¶×¤J
  22.     xPath = "D:\°]³ø¸ê®Æ"
  23.     IE_Application    '
  24.     Application.StatusBar = " "
  25.     Sheets(1).Activate
  26.     For Each E In Rng
  27.         With IE
  28.             Do While .Busy Or .ReadyState <> 4:    Loop
  29.             Set A = .Document.getelementbyid("STK_NO")
  30.             A.Value = E
  31.              .Document.getelementSbyNAME("login_btn")(0).Click  '«ö¤U¬d¸ß
  32.             Do While .Busy Or .ReadyState <> 4:    Loop
  33.             Set A = .Document.getelementsbytagname("TABLE")
  34.             xFile = xPath & "\" & E & "\HPM.txt"
  35.             MkDir_Sub xFile
  36.              With Sheets(1)
  37.                 .Cells.Clear
  38.                 For i = 1 To A(7).Rows.Length - 1
  39.                     For C = 0 To A(7).Rows(i).Cells.Length - 1
  40.                     .Cells(i, C + 1) = A(7).Rows(i).Cells(C).innertext
  41.                     Next
  42.                 Next
  43.                 .UsedRange.Sort Key1:=.Range("A2"), Order1:=xlDescending, Header:=True  '±Æ§Ç:xlDescending ( ¥Ñ¤j¦Ü¤p )
  44.                 Maketxt xFile, .UsedRange
  45.             End With
  46.             ii = ii + 1
  47.         End With
  48.         Application.StatusBar = Application.Text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤W¥«¦~¦¨¥æ " & ii & " ¤å¦rÀÉ"
  49.     Next
  50.     IE.Quit
  51.     Application.StatusBar = Application.Text(Time - t, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤W¥«¦~¦¨¥æ " & ii & " ¤å¦rÀÉ,  Åª¨ú§¹²¦ !! "
  52.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.Text(Time - t, ["MM¤ÀSS¬í"])
  53.     ThisWorkbook.Save
  54. End Sub
  55. Sub Maketxt(xF As String, Q As Range)   '***   Q As Range  ****
  56.     Dim fs As Object, E As Range, C As Variant
  57.     Set fs = CreateObject("Scripting.FileSystemObject")
  58.     Set fs = fs.CreateTextFile(xF, True)  '³Ð¨£¤@­ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
  59.     For Each E In Q.Rows   '­×§ï³o  Q.ResultRange.Rows
  60.     C = Application.Transpose(Application.Transpose(E.Value))
  61.         C = Join(C, vbTab)
  62.         fs.WriteLine C
  63.     Next
  64.     fs.Close
  65. End Sub
  66. Sub MkDir_Sub(S As String)
  67.     Dim AR, i As Integer, xPath As String
  68.     If Dir(S) = "" Then
  69.         AR = Split(S, "\")
  70.         xPath = AR(0)
  71.         For i = 1 To UBound(AR) - 1
  72.             xPath = xPath & "\" & AR(i)
  73.             If Dir(xPath, vbDirectory) = "" Then MkDir xPath
  74.         Next
  75.     End If
  76. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 46# smart3135
  1. For Each E In Rng
  2.         For Each X In Rng1
  3.             With IE
  4.          'http://forum.twbts.com/viewthread.php?tid=8111  chrom ¤¤¥i¬d¬Ý¤¸¯Àªºµ²ºc
  5.          '<select name="yy" class="input-select ui-corner-all" id="y_date1" onchange="query()">
  6.          '<option value="1996">85</option><option value="1997">86</option><option value="1998">87</option>         
  7.                 Set B = .document.getelementsbytagname("select")("YY")
  8.                 B.Value = X
  9.                 Set A = .document.getelementbyid("input_stock_code")
  10.                 A.Value = E
  11.    
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 48# smart3135
  1. Option Explicit
  2. Dim IE As Object
  3. Sub IE_Application()
  4.     Set IE = CreateObject("InternetExplorer.Application")
  5.     With IE
  6.         .Navigate "http://www.gretai.org.tw/ch/stock/statistics/monthly/st44.php"
  7.         .Visible = True   '¤£Åã¥Üie
  8.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  9.   End With
  10. End Sub
  11. Sub ¤WÂd¤ë¦¨¥æ¸ê°T()
  12.     Dim Rng As Range, Rng1 As Range, E As Range, X As Range, T As Date, xPath As String, xFile As String
  13.     Dim Ea As Variant, ar(), ii As Integer
  14.     T = Time
  15.     Application.DisplayStatusBar = True
  16.     '½Ð±N¤WÂdªºªÑ²¼¥N¸¹,¦b Sheets(3).Range("A1")©¹¤UKey¤W,°j°é¨Ì³o¸ÌªºªÑ²¼¥N¸¹¶×¤J
  17.     Set Rng = ThisWorkbook.Sheets(3).Range("A:A")
  18.     Set Rng1 = ThisWorkbook.Sheets(3).Range("b:b")
  19.     If Application.Count(Rng) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  20.     If Application.Count(Rng1) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  21.     Set Rng = Rng.SpecialCells(xlCellTypeConstants)
  22.     Set Rng1 = Rng1.SpecialCells(xlCellTypeConstants)
  23.     xPath = "G:\°]³ø¸ê®Æ"
  24.     IE_Application    '
  25.     Application.StatusBar = " "
  26.     For Each E In Rng
  27.         Sheets(1).UsedRange.Clear  '¤U¸ü¸ê®Æ¸m©ó¦¹¤u§@ªí,ÅÜ´«ªÑ²¼®É:²MªÅ
  28.         For Each X In Rng1
  29.             With IE
  30.                 .document.getElementsByTagName("select")("yy").Value = X
  31.                  With .document.getelementbyid("input_stock_code")
  32.                     .Value = E
  33.                     .ParentNode.submit
  34.                 End With
  35.                 Do While .Busy Or .readyState <> 4:    Loop
  36.                 If Application.Count(Sheets(1).UsedRange) = 0 Then '¦¹¤u§@ªí²MªÅ®É:¤U¸ü²Ä¤@¦~«×®É
  37.                     ar = Array(0, 2)
  38.                 Else
  39.                     ar = Array(2)
  40.                 End If
  41.                 For Each Ea In ar
  42.                     Ep .document.getElementsByTagName("TABLE")(Ea).outerHTML
  43.                 Next
  44.             ii = ii + 1
  45.             End With
  46.         Next X
  47.         xFile = xPath & "\" & E & "\HPM.txt"
  48.         MkDir_Sub xFile
  49.         Maketxt xFile, Sheets(1).UsedRange
  50.         Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ"
  51.     Next E
  52.     IE.Quit
  53.     Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ,  Åª¨ú§¹²¦ !! "
  54.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.Text(Time - T, ["MM¤ÀSS¬í"])
  55.     ThisWorkbook.Save
  56. End Sub
  57. Sub Ep(S As String)
  58.     Dim D As New DataObject, E As Shape, FormDLL As String
  59.     'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
  60.     '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
  61.     On Error GoTo ER
  62.     With D
  63.         .SetText S
  64.         .PutInClipboard
  65.         With Sheets(1)
  66.             .Range("a" & .Rows.Count).End(xlUp).Offset(1).Select
  67.             .PasteSpecial Format:="Unicode ¤å¦r"
  68.         End With
  69.     End With
  70.     Exit Sub
  71. ER:
  72.     FormDLL = "FM20.DLL"
  73.     ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\" & FormDLL
  74.     Resume
  75. End Sub
  76. Sub MkDir_Sub(S As String)
  77.     Dim ar, i As Integer, xPath As String
  78.     If Dir(S) = "" Then
  79.         ar = Split(S, "\")
  80.         xPath = ar(0)
  81.         For i = 1 To UBound(ar) - 1
  82.             xPath = xPath & "\" & ar(i)
  83.             If Dir(xPath, vbDirectory) = "" Then MkDir xPath
  84.         Next
  85.     End If
  86. End Sub
  87. Sub Maketxt(xF As String, Q As Range)    '±N¶×¤J¸ê®Æ¦s¤J«ü©wªºtxt
  88.     Dim fs As Object, E As Range, C As Variant
  89.     Q.Range("C1") = ""
  90.     Q.Range("a4", Q.Range("a4").End(xlDown)).Replace "¦~", ""
  91.     Q.Columns(1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  92.     Set fs = CreateObject("Scripting.FileSystemObject")
  93.     Set fs = fs.CreateTextFile(xF, True)  '³Ð¨£¤@­ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
  94.     For Each E In Q.Rows
  95.         C = Application.Transpose(Application.Transpose(E.Value))
  96.         C = Join(C, vbTab)
  97.         fs.WriteLine C
  98.     Next
  99.     fs.Close
  100. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 50# smart3135


   
¦ý¦b¶]¨ì .ParentNode.submit·|¥X²{¨S¦³¨Ï¥ÎÅv­­¡A¦]¬°¤£À´³o¬qµ{¦¡½Xªº·N«ä¡A¯à½Ð±z¦AÀ°¦£¤@¤U¶Ü¡H
§Æ±æµ²ªG¬°
103¦~4¤ë
103¦~3¤ë
103¦~2¤ë
103¦~1¤ë
¤W¥«,¤WÂdªººô­¶«Ø¸m¤£¤@¼Ë
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Dim IE As Object
  3. Sub IE_Application()
  4.     Set IE = CreateObject("InternetExplorer.Application")
  5.     With IE
  6.         .Navigate "http://www.twse.com.tw/ch/trading/exchange/FMSRFK/FMSRFKMAIN.php"
  7.         .Visible = True   '¤£Åã¥Üie
  8.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  9.   End With
  10. End Sub
  11. Sub ¤W¥«¤ë¦¨¥æ¸ê°T()
  12.     Dim Rng As Range, Rng1 As Range, E As Range, X As Range, T As Date, xPath As String, xFile As String
  13.     Dim Ea As Variant, ar(), ii As Integer
  14.     T = Time
  15.     Application.DisplayStatusBar = True
  16.     '½Ð±N¤WÂdªºªÑ²¼¥N¸¹,¦b Sheets(3).Range("A1")©¹¤UKey¤W,°j°é¨Ì³o¸ÌªºªÑ²¼¥N¸¹¶×¤J
  17.     Set Rng = ThisWorkbook.Sheets(3).Range("A:A")
  18.     Set Rng1 = ThisWorkbook.Sheets(3).Range("b:b")
  19.     If Application.Count(Rng) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  20.     If Application.Count(Rng1) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
  21.     Set Rng = Rng.SpecialCells(xlCellTypeConstants)
  22.     Set Rng1 = Rng1.SpecialCells(xlCellTypeConstants)
  23.     xPath = "D:\°]³ø¸ê®Æ"
  24.     IE_Application    '
  25.     Application.StatusBar = " "
  26.     For Each E In Rng
  27.         With Sheets(1)
  28.             .Activate
  29.             .Cells.Clear  '¤U¸ü¸ê®Æ¸m©ó¦¹¤u§@ªí,ÅÜ´«ªÑ²¼®É:²MªÅ
  30.         End With
  31.         For Each X In Rng1
  32.             With IE
  33.                 .Document.getElementsByTagName("select")("myear").Value = X
  34.                  With .Document.getelementbyid("STK_NO")
  35.                     .Value = E
  36.                     .Document.getelementSbyNAME("login_btn")(0).Click  '«ö¤U¬d¸ß
  37.                 End With
  38.                 Do While .Busy Or .readyState <> 4:    Loop
  39.                 Ep .Document.getElementsByTagName("TABLE")(7).outerHTML
  40.             End With
  41.         Next X
  42.         xFile = xPath & "\" & E & "\HPM.txt"
  43.         MkDir_Sub xFile
  44.         Maketxt xFile, Sheets(1).Range("A1").CurrentRegion, E.Value
  45.         ii = ii + 1
  46.         Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ"
  47.     Next E
  48.     IE.Quit
  49.     Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤WÂd¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ,  Åª¨ú§¹²¦ !! "
  50.     MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.Text(Time - T, ["MM¤ÀSS¬í"])
  51.     ThisWorkbook.Save
  52. End Sub
  53. Sub Ep(S As String)
  54.     Dim D As New DataObject, i As Integer, FormDLL As String, Rng As Range
  55.     'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
  56.     '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
  57.     On Error GoTo ER
  58.     With D
  59.         .SetText S
  60.         .PutInClipboard
  61.         With Sheets(1)
  62.             With .Range("a" & .Rows.Count).End(xlUp)
  63.                 If .Row = 1 Then
  64.                     Set Rng = .Cells
  65.                 Else
  66.                     Set Rng = .Offset(1)
  67.                 End If
  68.                 Rng.Select
  69.                 .Parent.PasteSpecial Format:="Unicode ¤å¦r"
  70.                 Set Rng = Rng.Range("A3", Rng.Range("A3").End(xlDown)).Resize(, 9)
  71.                 'Sort :¸ê®Æ±Æ§Ç
  72.                 Rng.Sort Key1:=Rng.Range("B2"), Order1:=xlDescending, Header:=xlYes ', _
  73.                 OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
  74.                 :=xlStroke, DataOption1:=xlSortNorma
  75.                 If .Row = 1 Then
  76.                     .Range("A2").EntireRow.Delete
  77.                 Else
  78.                     .Range("A2:A4").EntireRow.Delete
  79.                 End If
  80.             End With
  81.         End With
  82.     End With
  83.     Exit Sub
  84. ER:
  85.     ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
  86.     Resume
  87. End Sub
  88. Sub Maketxt(xF As String, Q As Range, Code As String)     '±N¶×¤J¸ê®Æ¦s¤J«ü©wªºtxt
  89.     Dim fs As Object, E As Range, C As Variant
  90.     Set fs = CreateObject("Scripting.FileSystemObject")
  91.     Set fs = fs.CreateTextFile(xF, True)  '³Ð¨£¤@­ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
  92.     Q.Cells(1) = Code & " ¤ë¦¨¥æ¸ê°T"   '¥[¤JªÑ²¼¥N¸¹
  93.     For Each E In Q.Rows
  94.         C = Application.Transpose(Application.Transpose(E.Value))
  95.         C = Join(C, vbTab)
  96.         fs.WriteLine C
  97.     Next
  98.     fs.Close
  99. End Sub
  100. Sub MkDir_Sub(S As String)
  101.     Dim ar, i As Integer, xPath As String
  102.     If Dir(S) = "" Then
  103.         ar = Split(S, "\")
  104.         xPath = ar(0)
  105.         For i = 1 To UBound(ar) - 1
  106.             xPath = xPath & "\" & ar(i)
  107.             If Dir(xPath, vbDirectory) = "" Then MkDir xPath
  108.         Next
  109.     End If
  110. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤p¨Æ¤£°µ¡B¤j¨ÆÃø¦¨¡C
ªð¦^¦Cªí ¤W¤@¥DÃD