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

¿é¤JªÑ²¼¥N¸¹,¸ê®Æ¤º®eÅã¥Ü©ó¤w½s¿èªºªí®æ¤º

¦^´_ 3# bioleon69

¡¶§Ú»Ý­n½s¿è,·Q­n¦Û¦æ³]­p¤@­Óªí®æ®æ¦¡,ªþÀɨS¦³§A¦Û¦æ³]­p¤@­Óªí®æ.
ÅýA3¿é¥Xªº¸ê®Æ¦b§Ú½s¿è¦nªºªí®æ®æ¦¡¤º,§A­n¦p¦ó½s¿èªþÀɨS¦³»¡©ú.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# bioleon69

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub CommandButton1_Click()
  3.     Dim strURL$ '«Å§istrURL¬°ÅܼÆ
  4.     strURL = "https://tw.stock.yahoo.com/d/s/dividend_" & [A1].Value & ".html" '©w¸qstrURLÅܼƤº®e
  5.     [A3].CurrentRegion = ""   '²M°£¤å¦r¨S²M°£®æ¦¡(¬ü¤Æ¦nªºªí®æ)
  6.     With ActiveSheet.QueryTables.Add("url;" & strURL, Range("a3"))
  7.         .WebFormatting = xlWebFormattingNone '(NONE)¤£¥]§t®æ¦¡,(ALL)¥]§t®æ¦¡
  8.         .WebSelectionType = xlSpecifiedTables '«ü©wtableªí®æ¼Ò¦¡
  9.         .WebTables = "8" '²Ä8­Ótableªí®æ
  10.         On Error Resume Next
  11.         .Refresh False
  12.         If Err <> 0 Then
  13.             [B1] = "½Ð¿é¤J¥¿½TªÑ²¼¥N¸¹"
  14.         Else
  15.             [B1] = ""
  16.         End If
  17.     End With
  18. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# bioleon69
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub CommandButton1_Click()
  3.     Dim strURL$ '«Å§istrURL¬°ÅܼÆ
  4.     strURL = "https://tw.stock.yahoo.com/d/s/dividend_" & [A1].Value & ".html" '©w¸qstrURLÅܼƤº®e
  5.     [A3].CurrentRegion = ""   '²M°£¤å¦r¨S²M°£®æ¦¡(¬ü¤Æ¦nªºªí®æ)
  6.     With ActiveSheet.QueryTables.Add("url;" & strURL, Range("a3"))
  7.         .WebFormatting = xlWebFormattingNone '(NONE)¤£¥]§t®æ¦¡,(ALL)¥]§t®æ¦¡
  8.         .WebSelectionType = xlSpecifiedTables '«ü©wtableªí®æ¼Ò¦¡
  9.         .WebTables = "8" '²Ä8­Ótableªí®æ
  10.         On Error Resume Next
  11.         .Refresh False
  12.         [B1] = ""
  13.         If Err <> 0 Then
  14.             [B1] = "½Ð¿é¤J¥¿½TªÑ²¼¥N¸¹"
  15.         Else
  16.             '**********************************
  17.             '"Äæ¼e"¬O§_¥i¥H¹ê²{¦p¦P¤å¦rÃC¦â­I´º¤@¼Ë,¯à°÷¦Û¾AÀ³?
  18.             '½Ð¿ý»s¥¨¶°«á®M¥Îµ{¦¡½X¦b¦¹
  19.             '*****************************'
  20.             [B1] = ºô­¶(strURL)  '¶ñ¤WªÑ²¼¦WºÙ¥N¸¹
  21.         End If
  22.     End With
  23. End Sub
  24. Private Function ºô­¶(Surl As String) As String
  25.     Dim oXmlhttp As Object, oHtmldoc As Object
  26.     Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  27.     Set oHtmldoc = CreateObject("htmlfile")
  28.     With oXmlhttp
  29.         .Open "Get", Surl, False
  30.         .Send
  31.         oHtmldoc.write .responseText
  32.     End With
  33.     ºô­¶ = Split(oHtmldoc.Title, "-")(0)
  34. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¤£­n¤p¬Ý¦Û¤v¡A¦]¬°¤H¦³µL­­ªº¥i¯à¡C
ªð¦^¦Cªí ¤W¤@¥DÃD