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

[µo°Ý] Â^¨ú¤WÂdªÑ»ù¦æ±¡~¹J¨ì«D¥æ©ö¤é§Y¸õ¥X¿ù»~°T®§!

[µo°Ý] Â^¨ú¤WÂdªÑ»ù¦æ±¡~¹J¨ì«D¥æ©ö¤é§Y¸õ¥X¿ù»~°T®§!

¦U¦ì¤j¤j:

¦A¦¸½Ð±Ð...
§Ú§ì¤WÂd³sÄò¦h¤éªº¦¬½L¦æ±¡®É,
¹J¨ì°²¤é(«D¥æ©ö¤é)®É,vba³£·|¥X²{¥H¤U°T®§~~°õ¦æ¶¥¬q¿ù»~'1004'-µLªk¶}±Ò³sµ²...


¸Óºô­¶(¤WÂd¨C¤é¦¬½L¦æ±¡¦³Ãöªº­ì©l½X¦p¤U


½Ð°Ý¸Ó«ç»ò­×§ï¥H¤Uªºvba¥N½X,
¨Ï¨ä¥i¥H¥ý§P©w·í¤é¦³¨S¦³¥æ©ö¸ê®Æ,¦A¶i¦æ¸ê®ÆÂ^¨ú/©Î¸õ¦Ü¤U¤@­Ó¥æ©ö¤é ???

(§ì¤W¥«¦¬½L»ù®É´Nºâ¹J¨ì°²¤é¤]¤£·|¥X²{¦¹¤@°ÝÃD,¦ý§ì¤WÂd¦¬½L»ù®É,«h·|¦³¿ù»~°T®§...)

·PÁÂ!!!
  1. '¤WÂd­ÓªÑ¾ú¥v¸ê®Æ
  2.    With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" _
  3.         , Destination:=ActiveCell.Offset(2, 0))
  4.    
  5.      
  6.         .FieldNames = True
  7.         .RowNumbers = False
  8.         .FillAdjacentFormulas = True
  9.         .PreserveFormatting = True
  10.         .RefreshOnFileOpen = False
  11.         .BackgroundQuery = True
  12.         .RefreshStyle = xlInsertDeleteCells
  13.         .SavePassword = False
  14.         .SaveData = False
  15.         .AdjustColumnWidth = True
  16.         .RefreshPeriod = 0
  17.         .WebSelectionType = xlSpecifiedTables
  18.         .WebFormatting = xlWebFormattingNone
  19.         .WebTables = "1,2,3"
  20.         .WebPreFormattedTextToColumns = True
  21.         .WebConsecutiveDelimitersAsOne = True
  22.         .WebSingleBlockTextImport = False
  23.         .WebDisableDateRecognition = False
  24.         .WebDisableRedirections = False
  25.         .Refresh BackgroundQuery:=False
  26.     End With
  27.    
½Æ»s¥N½X
·s¤â¤W¸ô

¦^´_ 1# cudui


¿ù»~°T®§³£¦b~µ{¦¡run¨ì .refresh BackgroundQuery:=False ®É¥X²{error(°õ¦æ¶¥¬q¿ù»~1004)
·s¤â¤W¸ô

TOP

http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_1010419.CSV
§A¤S§ì¨ì¨S¦³¸ê®Æªººô­¶¤F....


³oºô­¶§Ú½T©w¬O¥i¥Hrun±o¨ì¸ê®Æ¤U¨Óªº~~
¥æ©ö¤é¨S¦³°ÝÃD,¦ý¬O«D¥æ©ö®ÉµLdata®É¤~·|¥X¿ù~


   §Aªº°ÝÃD«ÜÅ¢²Î...¨Sªk§¹¾ã¦^µª......¦pªG¬O¤@­Ó¥i¥¿½Trunªºvba,¤]­n¥ý»¡©ú§Aªº­ÓÅÞ¿è...
    ³Ì²³æªº¤èªk¬O±N¾ã¦~ªº¥æ©ö¤é´Á­p¹º®³¨ì,¤ñ¹ï±ý§ì¨úªº¤é´Á¥Ø¼Ð,¨Ì§P©wÅܧóreportªºhtml.....


¥æ©ö¤é¨C¦~³£¤£¦P,©Ò¥H¥Î¤ñ¹ïªº¤èªk,·|¤ñ¸û³Â·Ð~
§Úªº°ÝÃD¥i¯àÁÙ¤£°÷©ú½T,
§Æ±æ±o¨ìªº¸Ñµª¬O:¦p¦ó¦b¸Óvba¤º,²K¥[§PÂ_¦¡---§PÂ_­Y¹J¨ì"¬d¸ß¥¢±Ñ"©Î"¬dµL¸ê®Æ"®É,¥i¥H goto NEXT one,Ä~Äò¥¼§¹ªº¬d¸ß,¦Ó«D¸õ¥X....
(¦]¬°¤£ª¾¹D·í htmlµL¸ê®Æ¥iÂ^¨ú®É,·|¦^õX¤°»ò¼Ëªº°T¸¹...)
·s¤â¤W¸ô

TOP

¦^´_ 7# GBKEE
  1. If Err.Number <> 0 Then Err.Clear: MsgBox "¸ê®Æ¬d¸ß¥¢±Ñ"
½Æ»s¥N½X
½Ð°ÝG¤j, ¸Ó¦æ¥i¥H§ï¦¨¤U¦C¼gªk¶Ü?
If Err.Number <> 0 Then
GOTO ABC123
END IF
....

ABC123:
Next J ....



ÁÂÁÂ!!
·s¤â¤W¸ô

TOP

''¤WÂd­ÓªÑ¾ú¥v¸ê®Æ
   With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.otc.org.tw/ch/st ...
chen_cook µoªí©ó 2012-4-20 07:14


ÁÂÁ¤j¤j¤F,
§Ú¦A¸Õ¸ÕCSV & Html°õ¦æ¦³¤°»ò®t§O~~
·s¤â¤W¸ô

TOP

¥HG¤jªº·§©À©µ¦ù..

¦b¥X°ÝÃDªº¨º¤@¦C¤§«e,¼W¥[:
"On Error Resume Next"

´N¯à¸õ¹L¿ù»~°T®§¤F!!
·s¤â¤W¸ô

TOP

¦^´_ 5# chen_cook

ÁÂÁÂCOOK¤j,
§Ú¥H§Aªº»yªk§ï¼g´N¥i¥H¥Î¤F!!
·s¤â¤W¸ô

TOP

¥»©«³Ì«á¥Ñ cudui ©ó 2012-4-22 14:12 ½s¿è

¦A½Ð°Ý¤@¤U~~

§Ú­ì¥ý§ìªº¬Ohtmlªº¸ê®Æ,¥i¥H¤£»Ý¦A³B²zCSVÀɶפJªº°ÝÃD,
(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" _

¦ý¬O,¨Ï¥Îhtml¹J¨ìªºª¬ªp¬O~
§ÚÂ^¨ú¨ä¥L¥æ©ö¤éªº®É­Ô³£¨S°ÝÃD,¦ý¤@¥¹­n¶×¤J"2/10","4/10"...µ¥n¤ë 10¤éªº¥æ©ö¸ê®Æ®É,
­ÓªÑ¦æ±¡°£ÀɦW¥~,¨ä¾l´N·|¬O¤@¤ùªÅ¥Õ...(¦ýn¤ë20¤é.30¤é³£¨S°ÝÃD,©Ò¥HÀ³¸Ó¤£¬O"0"ªº°ÝÃD)
¦Ó§ÚÀˬd¹ê»Ú³sµ²¤]³£¥¿½T,¥i¥H¥¿½T³sµ²¨ì¸Óºô­¶
(http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_1010410.html)
¦Ó¨Ï¥ÎCSV«hµL¦¹°ÝÃD~~

¦³¨S¦³¤j¤j¥i¥HÀ°¦£¸Ñ´b¤@¤U³o¨ì©³¬O¦]¬°¤°»ò????
ÁÂÁÂ!

ªþ¤W­ì©l½X¦p¤U:


  1. '¤WÂd­ÓªÑ¾ú¥v¸ê®Æ
  2.    With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" _
  3.         , Destination:=ActiveCell.Offset(2, 0))
  4.    
  5.         .FieldNames = True
  6.         .RowNumbers = False
  7.         .FillAdjacentFormulas = True
  8.         .PreserveFormatting = True
  9.         .RefreshOnFileOpen = False
  10.         .BackgroundQuery = True
  11.         .RefreshStyle = xlInsertDeleteCells
  12.         .SavePassword = False
  13.         .SaveData = False
  14.         .AdjustColumnWidth = True
  15.         .RefreshPeriod = 0
  16.         .WebSelectionType = xlSpecifiedTables
  17.         .WebFormatting = xlWebFormattingNone
  18.         .WebTables = "1,2,3,4"
  19.         .WebPreFormattedTextToColumns = True
  20.         .WebConsecutiveDelimitersAsOne = True
  21.         .WebSingleBlockTextImport = False
  22.         .WebDisableDateRecognition = False
  23.         .WebDisableRedirections = False
  24.         On Error Resume Next
  25.         .Refresh BackgroundQuery:=False
  26.       
  27.     End With
½Æ»s¥N½X
·s¤â¤W¸ô

TOP

¦^´_  cudui
[¦b¥X°ÝÃDªº¨º¤@¦C¤§«e,¼W¥[: "On Error Resume Next"]
¦b¨ºµ{§Ç¤¤ ¹w­p·|µo¥Í¿ù»~ªºµ{¦¡½X ...
GBKEE µoªí©ó 2012-4-22 15:23


G¤j:

§Ú¥Î [A1]="URL;http://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_" & myear & mmon & nowday & ".html" ¥h¬Ý,
±o¥X¨Óªº³sµ²¤´¬Ohttp://www.otc.org.tw/ch/stock/aftertrading/otc_quotes_no1430/SQUOTE_AL_1010410.html¨S¿ù,
¦Ó¥B,
¦pªG¯u¬O¤G¦ì¼Æªº°ÝÃDªº¸Ü,
¤£À³¸ÓN¤ëªº20¤é / 30¤é³£¥i¥H§ì¨ì¸ê®Æ,
¦ý10¤é«h§ì¤£¥X¨Ó...

¥t¥~,§Ú¦b¤§«e¤]¦³¥[¤J§PÂ_¦¡~ N<9«h«e­±¥["0",
¨Ã¥[¼g  nowday = Left(nowday & "0", 2)...
¥i¬Oµ²ªG³£¤@¼Ë~~
·s¤â¤W¸ô

TOP

¦^´_  cudui
À³¬O³oºô­¶ªº°ÝÃD À°§A¬Ý¤F¤@¤U 3/1 ,3/2, 4/10  ³£µLªk¶×¤J
¥i§ï¥Î  Workbooks.Open ("ht ...
GBKEE µoªí©ó 2012-4-22 17:14



ÁÂÁÂG¤j!
§Ú¦³§ï¥ÎCSV½T©w¨S¦³°ÝÃD,
¥u¬O¤£À´¬°¦ó¥Î"HTML"¤~·|¥X²{¦¹¤@ª¬ªp....¦n©_¬Oµ{¦¡­þ¸Ì¨S¼g¦n¦Ó¤w...
·s¤â¤W¸ô

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD