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

[µo°Ý] ¦³¤j¤j¯à§ä¨ì¹d¦ëºôªºÁôÂúô§}¶Ü?¥H¤Îºô­¶¤¸¯À°ÝÃD

[µo°Ý] ¦³¤j¤j¯à§ä¨ì¹d¦ëºôªºÁôÂúô§}¶Ü?¥H¤Îºô­¶¤¸¯À°ÝÃD

¥»©«³Ì«á¥Ñ PKKO ©ó 2016-10-7 15:29 ½s¿è

http://www.cnyes.com/twstock/ps_historyprice/3514.htm
ºô§}¸Ì­±¦³¤@­Ó¶}©l¸òµ²§ô¤é´Á
½Ð¤j¤j­Ì±Ð¾É¦p¦ó§ä¥XÁôÂ꺺ô§}¡A¥i¥Hª½±µ±qºô§}·í¤¤±±¨î°_¨´¤é´Á
³o¼Ë´N¥i¥Hª½±µ¥Î¿ý»s¥¨¶°ªº¤è¦¡¤U¸ü(·Pı³oºØ¤è¦¡¤ñ¸ûí©w)

§Ú¥Ø«e¨Ï¥Îºô­¶¤¸¯À¥i¥H±±¨î°_¨´¤é´Á¡A¦ý¸I¨ì¤@­Ó°ÝÃD¬O
·í´£¥X¬d¸ß«ö¶sªº®É­Ô¡AµLªk±oª¾ºô­¶¦ó®É¶]§¹
¾É­Pºô­¶ÁÙ¨S¶]§¹¡Aµ{¦¡½X¤w¸gÄ~Äò©¹¤U°õ¦æ¤F
³o¼Ë·|¾É­P¸ê®Æ¬O(®×¤U¬d¸ß«ö¶s¤§«eªº¸ê®Æ)
  1. Sub testDL()   '¤U¸üªÑ²¼¸ê°T
  2. Set ie = CreateObject("InternetExplorer.Application")
  3. ie.Visible = True
  4. ie.Navigate "http://www.cnyes.com/twstock/ps_historyprice/" & "3514" & ".htm"
  5. Do While ie.readyState <> 4: DoEvents: Loop
  6. st_date = "2016/01/01"
  7. With ie.Document
  8.     '¶}©l¤é´Á
  9.     For Each E In .GetElementsByTagName("INPUT")
  10.         If E.ID = "ctl00_ContentPlaceHolder1_startText" Then
  11.             E.Value = st_date: Exit For
  12.         End If
  13.     Next
  14.     '¬d¸ß«ö¶s
  15.     Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop
  16.     For Each E In .GetElementsByTagName("INPUT")
  17.         If E.ID = "ctl00_ContentPlaceHolder1_submitBut" Then
  18.             E.Click: Exit For
  19.         End If
  20.     Next
  21.     '=================================¤U¸ü¸ê®Æ=================================
  22.     Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop'³o¦æµ{¦¡½XµL®Ä¡AµLªk¯uªºµ¥«Ýºô­¶°õ¦æ®É¶¡
  23.     MsgBox "ºô­¶¹ê»Ú¤WÁÙ¨S§¹¦¨!¾É­P¤U¸üªº¸ê®Æ¬Oªº"
  24. End With
  25. ie.Quit
  26. End Sub
½Æ»s¥N½X
PKKO

¦^´_ 10# PKKO


   



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

TOP

¦^´_  ketrddem
ketrddem ¤j¤j¡A±z¦n¼F®`­C¡A¥Î¤U¸üªº¤è¦¡¤S§Ö¤Sí¡A§Y«K¿ù»~¤]¤£·|¤¤Â_= =¦n¦h°ÝÃD·Q¦V¤j ...
PKKO µoªí©ó 2016-10-8 13:12



¤@¡B»Pjoey0415¤j¤j°ÝÃD¬Û¦P¡A¤U¦Cµ{¦¡½XµLªk¹B§@¡A·í¦h­«±ø¥óªº®É­Ô­n¦p¦ó¿é¤J?
¦h±ø¥ó®É¡AÀ³¸Ó´N­n¦bªÑ²¼¥N¸¹³¡¥÷°µ­­©w¡A¥[if¥h§PÂ_­n¤£­n¶×¤J³o­ÓªÑ²¼ªº¾ú¥v¼Æ¾Ú¡C
for i = ªÑ²¼¥N¸¹ to lostrow
    if i XXXX  then
        goto ABC
   end if

ABC:
next

¨º­Ó§ìµ²§ô¤é´Áªº¡AÀ³¸Ó¬O¨S¦³¥Î³Bªº¡A¦L¶H¤¤¹d¦ë´N¬Oª½±µÅã¥Ü³Ì·s¸ê®Æ


¤G¡B¥Î¤U¸üªº¤è¦¡¸ê®Æ¤@©w­n¥ý©ñ¦bEXCEL¤W­±¶Ü?¥i§_ª½±µ¿é¥X¨ì°}¦C¤W­±?
§Ú¨S¸Õ¹L¯à¤£¯à¿é¥X¨ì°}¦C¡A­Ó¤H²z¸Ñ¬O¤£¦æ¡A¦]¬°¨S¦³½á­È¡C
¾ú¥v¸ê®ÆªºÀ³¥Î¡A¤p§Ì¬O¥þ¼Æ§ì¨ì¤@­Ó¡u¾ú¥vªÑ»ù¡vxlsm¡C
­pºâ¤W¡A´N¥Î¥t¤@­Óexcel¡A¥ÎSQL§ì¤U¨Ó¡A­pºâ«á¦A§R°£¡C°ò¥»¤W¥Î°}¦C­pºâ¡A®Ä²v«Ü°ª¡C

¤T¡B±z¦p¦ó§ä¨ì¸Ó¦r¦êªº? ¬°¦ó¤£¬O¿é¤JBÄæ¦ìªºID¦r¦ê¦Ó¬O¿é¤JCÄæ¦ìªºNAME¦r¦ê?ºô­¶³£¬O¿é¤JNAME¦r¦ê¶Ü?
¥ÎIE¡A¶}µoªÌ¤u¨ã¡A§äPOSTªº¤¸¯À´N§ä±o¨ì¤F¡C¦ý¦b§ä¤§«e¡A­n­«·s¾ã²zºô­¶¡AÅýºô­¶¹ê»Ú¶]¤@¦¸ºô­¶ªºÅܤơA³o®É­Ô´N¯à¬Ý¨ìPOST¦b§ì¤°»ò¤¸¯À¤F¡C


¥|¡B¥u­n¬O¿é¤JÅܼƳ£¬O¨Ï¥Î.PostText ³o­Ó«ü¥O¶Ü?ÁÙ¬O¦³¦óÅܤÆ
³o¤@ÂI¡A¤p§Ì¤£ª¾­C¡A§Ú¨Sª±±o³o»òºë¡A´N³æ¯Â§ì¾ú¥v¸ê®Æ³o­Ó¥\¯à¹ê²{¤F´NOK¤F¡A«áÄò¤]¨S¦A²`¤JºN¯ÁPOST³o¤èªk¤F¡C


¤­¡B©Î³\¤p§Ì°ÝÃD¤Ó¦h³y¦¨±z§x¾É¡A½Ð°Ý¥i¥H¦b­þÃä§ä¨ìÃö©ó¤U¸üªº¸Ô²Ó¬ÛÃö¤èªk©O?
«Ü¤[¥H«eºN¯Áªº¡A²{¦b¥s§Ú¦^·Q±q¨ºùصo²{³o­Ó¤èªk©Î¸ê®Æªº¡A¦³ÂIÃø«×¡C§Ñ¥ú¥ú¤F
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_  ketrddem

¤j¤jªº¦^µª¯u´Î¡I

½Ð°Ý¤@¤U
.PostText = "ctl00$ContentPlaceHolder1$startText="  ...
joey0415 µoªí©ó 2016-10-8 12:02


¹d¦ë¡A¦L¶H¤¤¦n¹³¬Oª½±µ§ì¨ì³Ì·s¸ê®Æ¡C
¦ý¥¦¦³¤@­Ó¯ÊÂI¡A³]©wªº°_©l¤é¡A¦³®É§ì¨ìªº¸ê®Æ®Ú¥»´N¤£¬O¨º¤@¤Ñ¡C
µL©Ò¿×¡A¤Ï¥¿­nªº¬O¾ú¥v¸ê®Æ¡A¨Æ«á¦A°µ¹Bºâ¦Ó¤w
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 7# GBKEE
¶Wª©¤j¤j±z¦n¡A¤p§Ì§ä¤£¨ì³o¬qµ{¦¡½Xªº¸ê®Æ
  1. Set xTable = .all.tags("table")(1)
½Æ»s¥N½X
±q°Ï°ìÅÜ¼Æ·í¤¤,¤£¾å±o³o­Ó.all.tags("table")¦b­þÃä= =


¤p§Ì¤Ó¹à¤F¡AÁٽЫü±Ð¡Aºô­¶¤¸¯À¤]¬O¸ò¶Wª©¤j¤j¾Ç²ßªº
¦ý³o­Ó.all.tags("table")¥H«e§¹¥þ¨S¬Ý¹L@@
PKKO

TOP

¦^´_ 6# ketrddem
ketrddem ¤j¤j¡A±z¦n¼F®`­C¡A¥Î¤U¸üªº¤è¦¡¤S§Ö¤Sí¡A§Y«K¿ù»~¤]¤£·|¤¤Â_= =¦n¦h°ÝÃD·Q¦V¤j¤j½Ð±Ð
¤@¡B»Pjoey0415¤j¤j°ÝÃD¬Û¦P¡A¤U¦Cµ{¦¡½XµLªk¹B§@¡A·í¦h­«±ø¥óªº®É­Ô­n¦p¦ó¿é¤J?
  1. With QT
  2. .PostText = "ctl00$ContentPlaceHolder1$startText=" & "2016/01/01"
  3. .PostText = "ctl00$ContentPlaceHolder1$endText=" & "2016/05/01"
  4. .WebTables = "2"
  5. .Refresh False
  6. .Delete
  7. End With
½Æ»s¥N½X
¤G¡B¥Î¤U¸üªº¤è¦¡¸ê®Æ¤@©w­n¥ý©ñ¦bEXCEL¤W­±¶Ü?¥i§_ª½±µ¿é¥X¨ì°}¦C¤W­±?
¤T¡B±z¦p¦ó§ä¨ì¸Ó¦r¦êªº?

¬°¦ó¤£¬O¿é¤JBÄæ¦ìªºID¦r¦ê¦Ó¬O¿é¤JCÄæ¦ìªºNAME¦r¦ê?ºô­¶³£¬O¿é¤JNAME¦r¦ê¶Ü?
¥|¡B¥u­n¬O¿é¤JÅܼƳ£¬O¨Ï¥Î.PostText ³o­Ó«ü¥O¶Ü?ÁÙ¬O¦³¦óÅܤÆ
¤­¡B©Î³\¤p§Ì°ÝÃD¤Ó¦h³y¦¨±z§x¾É¡A½Ð°Ý¥i¥H¦b­þÃä§ä¨ìÃö©ó¤U¸üªº¸Ô²Ó¬ÛÃö¤èªk©O?

¥H¤W³Â·Ð¤j¤j¤F¡A¦A¦¸´£¥X¸U¤À·P¿E
PS:¤j¤j®Ú¥»¤£¬OVBA·s¤â¡A±zÀ³¸Ó­n§âñ¦WÀÉ´«±¼¤F><"
PKKO

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2016-10-8 12:04 ½s¿è

¦^´_ 6# ketrddem

¤j¤jªº¦^µª¯u´Î¡I

½Ð°Ý¤@¤U
.PostText = "ctl00$ContentPlaceHolder1$startText=" & ¬d¸ß°_©l¤é

¤¤¥[¤Jµ²§ô¤é´Áctl00$ContentPlaceHolder1$endText¡A¦n¹³¤£·|¸õ°Ê

³o­Ó¤èªk¦n¦V¤£¥Î¦A¥[¨º¤@¦êªº__EVENTVALIDATION¬O¶Ü¡H

¦bWITH¤¤³Ì«á¥[¤W.DELETE¡A´N¥i§R°£³s½u

TOP

¦^´_ 1# PKKO

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub testDL()   '¤U¸üªÑ²¼¸ê°T
  3.     Dim IE As Object, st_date As String, xTable As Object, R As Integer, C As Integer
  4.     st_date = "2016/02/01"
  5.     Set IE = CreateObject("InternetExplorer.Application")
  6.     IE.Visible = True
  7.     IE.Navigate "http://www.cnyes.com/twstock/ps_historyprice/" & "3514" & ".htm"
  8.     Do While IE.readyState <> 4: DoEvents: Loop
  9.     With IE.Document
  10.         R = .ALL.tags("table")(1).Rows.Length ' '**¸ê®Æ¼Æ(§tªíÀY): ºô­¶¹w³]Åã¥Ü¬°¤@­Ó¤ëªº¸ê®Æ
  11.         '¶}©l¤é´Á
  12.         ' ************* ¦³ID ¥iª½±µ¥ÎIDªº¦WºÙ********
  13.         .GetElementByid("ctl00_ContentPlaceHolder1_startText").Value = st_date
  14.         Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop
  15.         'For Each E In .GetElementsByTagName("INPUT")
  16.         '    If E.ID = "ctl00_ContentPlaceHolder1_startText" Then
  17.         '        E.Value = st_date: Exit For
  18.         '    End If
  19.         'Next
  20.         '¬d¸ß«ö¶s
  21.         .GetElementByid("ctl00_ContentPlaceHolder1_submitBut").Click
  22.         'For Each E In .GetElementsByTagName("INPUT")
  23.         '    If E.ID = "ctl00_ContentPlaceHolder1_submitBut" Then
  24.         '        E.Click: Exit For
  25.         '    End If
  26.         'Next
  27.         '=================================¤U¸ü¸ê®Æ=================================
  28.         Do While IE.readyState <> 4 Or IE.Busy: DoEvents: Loop    '³o¦æµ{¦¡½XµL®Ä¡AµLªk¯uªºµ¥«Ýºô­¶°õ¦æ®É¶¡

  29.         Do
  30.             DoEvents
  31.             Set xTable = .ALL.tags("table")(1)
  32.             If xTable.Rows.Length <> R And xTable.Rows.Length > 1 Then Exit Do ''** µ¥­Ô¸ê®Æ¤é¼Æµ¥©ó«ü©wªº¤é¼Æ
  33.             ' µ¥«á¸ê®Æ¤U¸ü®É: xTable.Rows.Length=1
  34.         Loop
  35.         '=================================¤U¸ü¸ê®Æ=================================
  36.         With ActiveSheet
  37.             .UsedRange = ""
  38.             For R = 0 To xTable.Rows.Length - 1
  39.                 For C = 0 To xTable.Rows(R).Cells.Length - 1
  40.                     .Cells(R + 1, C + 1) = xTable.Rows(R).Cells(C).innertext
  41.                 Next
  42.             Next
  43.         End With
  44.         MsgBox "¸ê®Æ¤U¸ü§¹¦¨!"
  45.     End With
  46.     IE.Quit
  47. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ ketrddem ©ó 2016-10-8 01:57 ½s¿è

¤£­n¥Îºô­¶¤¸¯À¨Ó§ì¡Aª½±µ¥Î¶×¤J´N¦n¤F ¾ú¥vªÑ»ù.rar (47.72 KB)

¶}±Ò«á¡A§â§A·Q§ìªº¾ú¥vªÑ»ù¿é¤J¨ì¡u²M³æ¡vªº²Ä¤@Äæ
µM«á«ö¡u­««Ø¾ú¥vªÑ»ù¡v
§A­nªº´NÀ°§A§ì¦nÅo
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 3# PKKO

³o¨â­Óºô¯¸¨S¿ù¡A¤£¹L½Ð§A¤U¸ü¨C¤Ñªº½L«á¥æ©öÀÉ¡A¤£¬O¤ëÀÉ

¤@¦~250¤Ñ¡A¤­¦~¤~1250¦¸

¤W¥«¥[¤WÂd ¦@2500¦¸¡A§A·|ª¦¤U¨Ó¡A¤@¬í¤@¦¸¡A¤@¤p®É´N¥þ³¡§ì¤U¨Ó¤F

³o¨â­Óºô¯¸¤~¦³¥¿½Tªº¸ê®Æ¡A¨ä¥¦ºô¯¸³£·|¦³°±¾÷»P¸ê®Æ¤£¥¿½Tªº°ÝÃD

¹d¦ë§Aª¦1000¦¸¬Ý¬Ý¡A§A´Nª¾¹D¸ê®Æ¤U¸ü·|¦³°ÝÃD¡Aºô­¶ªº§ÖºC¤£¬O¾aª¦ÂδN¯à¸Ñ¨M

³o¨â­Óºô¯¸¤£·|Àɪ¦ÂÎ

TOP

        ÀR«ä¦Û¦b : ¦a¤WºØ¤Fµæ¡A´N¤£©öªø¯ó¡F¤ß¤¤¦³µ½¡A´N¤£©ö¥Í´c¡C
ªð¦^¦Cªí ¤W¤@¥DÃD