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

[µo°Ý] ºô­¶¸ê®ÆµLªk¤U¸ü¦¨¥\

[µo°Ý] ºô­¶¸ê®ÆµLªk¤U¸ü¦¨¥\

³Ìªñ»Ý­n±N¬Y­Óºô­¶ªº¸ê®Æ¹B¥Î¨ìexcelÀɤ¤¡A«oµo²{¤£¯à§Q¥Îexcel"¸ê®Æ"-->"¶×¤J¥~³¡¸ê®Æ"-->"·s¼Wweb¬d¸ß"ªº¤è¦¡ª½±µ¶×¤J

·|¥X²{"¦¹web¬d¸ß¨S¦³¦^¶Ç¸ê®Æ"ªº´£¥Ü¡Aª¦¤å«áµo²{¥i¥H¥ÎVBA¨Ó¶×¤J

§Ú»Ý­n§ì¨úªº°]°È¸ê®Æºô§}¦p¤U

http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_2891.djhtm

¦ý¬O¤p§Ì¾ÇÃÀ¤£ºë¡AÁöµM¦³§ä¨ìGBKEE¤j¤j«ü¾É¨ä¥L¤Hªºµ{¦¡½X(http://forum.twbts.com/viewthread.php?tid=7586)

¦ýª½±µ­×§ïµ{¦¡½Xªº¤º®e¤§«á¡A¤´¥u¯àÅã¥Ü²Ä¤@¦æ¸ê®Æ´N·|¥X²{¿ù»~"¨S¦³³]©wª«¥óÅܼƩÎWith°Ï¶ôÅܼÆ"

µ{¦¡½X¦p¤U
  1. Sub Ex()
  2.     Dim xlVbTable As Object, Ar, R As Integer, C As Integer
  3.     With CreateObject("InternetExplorer.Application")
  4.         .Visible = True
  5.        .Navigate "http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_2891.djhtm"
  6.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  7.         Set xlVbTable = .document.getelementsbytagname("table")(11)
  8.         Ar = Split(xlVbTable.Rows(0).Cells(0).innerText, Chr(10))(1)
  9.         With ActiveSheet
  10.             .Cells(1, 1) = Mid(Ar, 1, InStr(Ar, ":"))
  11.             .Cells(1, 2) = Mid(Ar, InStr(Ar, ":") + 1, 9)
  12.             For R = 1 To xlVbTable.Rows.Length - 1
  13.                 For C = 0 To xlVbTable.Rows(1).ALL.Length - 1
  14.                     .Cells(R + 1, C + 1) = xlVbTable.Rows(R).Cells(C).innerText
  15.                 Next
  16.             Next
  17.         End With
  18.        .Quit
  19.     End With
  20. End Sub
½Æ»s¥N½X
¤£ª¾¹DGBKEE¤j¤j¯à§_À°¦£¬Ý¤@¤U

·P®¦

¥i¥H®@¡I

³Ñ¤Uªº¦Û¤v§ï

¦^´_ 1# chingmac
  1. Sub ex()
  2.     With ActiveSheet.QueryTables.Add(Connection:= _
  3.         "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_2891.djhtm", Destination:=Range("A1"))
  4.         .WebFormatting = xlWebFormattingNone
  5.         .Refresh BackgroundQuery:=False
  6.         .Delete
  7.     End With
  8. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# joey0415


·PÁÂjoey0415¤j¤jªº¼ö¤ßÀ°¦£¡Aµ{¦¡½X°õ¦æ¦¨¥\¡I

¦ý²{¦b¥X²{¤F¥t¤@­Ó°ÝÃD¡A¦]¬°¨ä¹ê§Ú¤w¸g±N·Q¤U¸üªºªÑ²¼¥N½X¿é¤J¦Ü¥t¤@­Ósheet¸Ì­±(¨Ò¦p¬Osheet2ªºB3¨ìB5)

­×§ï«áªºµ{¦¡½X¦p¤U
  1. Sub ex()
  2.     Dim Webpage As String
  3.     Row = 3
  4.     Do While Worksheets("sheet2").Cells(Row, 2).Value <> ""
  5.             Webpage = "http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & Worksheets("sheet2").Cells(Row, 2).Value & ".djhtm"
  6.             With ActiveSheet.QueryTables.Add(Connection:= _
  7.             "URL;Webpage", Destination:=Range("A1"))
  8.             .WebFormatting = xlWebFormattingNone
  9.             .Refresh BackgroundQuery:=False
  10.             .Delete
  11.             End With
  12.             Row = Row + 1
  13.     Loop
  14. End Sub
½Æ»s¥N½X
¥»¨Óªº·Qªk¬O³]©w¤@­ÓWebpageÅܼÆÀx¦sºô§}¡A§Q¥ÎºÊ¬Ý¦¡¤]µo²{¸ÓÅܼƭȬO¦p§Ú©Ò­nªº

¥i¬O¨ì¤F­n°õ¦æ²Ä5¦æªº®É­Ô¡A«o¥X²{"µ{§Ç©I¥s©Î¤Þ¼Æ¤£¥¿½T"¡A§ä¤F«Ü¤[¡AÁÙ¬O¤£ª¾¹D°ÝÃD¥X¦b­þ¸Ì

¥i§_½Ð±Ð¦U¦ì¤j¤j¨ó§U­×§ï¡A©ÎªÌ¦³§ó¦nªº¼gªk¡A·PÁ¡I

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2014-11-30 10:44 ½s¿è

¦^´_ 3# chingmac

§¹¥þ¨S¦³ÃD®@¡I

§Úªá¤£¨ì¤Q¬í´N§¹¦¨¤G¤QÀɤF

²Ä¤@­¶©ñªÑ²¼¥N½X

²Ä¤G­¶°õ¦æ
  1. Sub ex()

  2. Worksheets(2).Activate
  3. Worksheets(2).Cells.Delete
  4. For i = 1 To 20
  5.     sname = Worksheets(1).Cells(i, 1)

  6.     With ActiveSheet.QueryTables.Add(Connection:= _
  7.         "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & sname & ".djhtm", Destination:=Range("A1"))
  8.         .WebFormatting = xlWebFormattingNone
  9.         .Refresh BackgroundQuery:=False
  10.         .Delete
  11.     End With
  12.     'Worksheets(2).Cells.Delete
  13.    
  14. Next


  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# chingmac
Rows(1) §ï¦¨ -> Rows(R)

For R = 1 To xlVbTable.Rows.Length - 1
     For C = 0 To xlVbTable.Rows(1).ALL.Length - 1
             .Cells(R + 1, C + 1) = xlVbTable.Rows(R).Cells(C).innerText
     Next
Next
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# joey0415

¦A¦¸·PÁÂjoey0415¤j¤jªº¼ö¤ßÀ°¦£¡I±q±zªºµ{¦¡½X¤ºµo²{­ì¨Ó¦b§Ú¤§«e­×§ïªºµ{¦¡½X¤º¡A§Ú¤£»Ý­n³]©w¤@­ÓWebpageÅܼƨӦs©ñºô§}

ª½±µ¥ÎNum·íªÑ²¼¥N½XªºÅܼơA§âURL«á­±ªººô§}¼g¬°http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_" & Num & ".djhtm´N¦æ¤F

¥i¬O¦b°õ¦æ²Ä¤@¤äªÑ²¼3474ªº®É­Ôµo²{¡Ahttp://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_3474.djhtmªººô­¶¤º¨ÃµL¸Ó¤äªÑ²¼ªº¸ê®Æ

¤Ï¦Ó­n¨ìhttp://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_3474.djhtm³o­Óºô­¶¤~¦³§Ú­nªº¸ê®Æ

µ²ªG²{¦bÅܦ¨­n³B²z¨âºØ±¡§Î¡A­Y²Ä¤@ºØºô­¶¦³§Ú­nªº¸ê®Æ´Nª½±µ¶×¤J¡A¦pªG¨S¦³¡A´N§ï¶×²Ä¤GºØºô­¶

§Úªº·Qªk¬O¤£ºÞ¦p¦ó³£¥ý¤U¸ü²Ä¤@ºØºô­¶¡A¦A§Q¥ÎIF»yªk§PÂ_¡A­Y¦bB4Àx¦s®æ¤º¥X²{"¬dµL"ªº¦r¦ê¡A´N¦A¶×¤J²Ä¤GºØºô­¶

§_«h¤£¶i¦æ¥ô¦ó°Ê§@¡Aª½±µ¸õ¤U¤@¤äªÑ²¼¡Aµ{¦¡½X¦p¤U¡G
  1. Sub ex()
  2.     Dim Num As String
  3.     Row = 5
  4.     Worksheets("ªÑªFÅv¯q³ø¹S²v").Activate
  5.     Do While Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value <> ""
  6.         Num = Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value
  7.         With ActiveSheet.QueryTables.Add(Connection:= _
  8.             "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_" & Num & ".djhtm", Destination:=Range("A1"))
  9.             .WebFormatting = xlWebFormattingNone
  10.             .Refresh BackgroundQuery:=False
  11.             .Delete
  12.         End With
  13.         Set myRange = Worksheets("ªÑªFÅv¯q³ø¹S²v").Range("B4")
  14.         If (Application.WorksheetFunction.IsError(Application.WorksheetFunction.Search("¬dµL", myRange)) = False ) Then
  15.             Range("B1:C50").Delete
  16.             With ActiveSheet.QueryTables.Add(Connection:= _
  17.             "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & Num & ".djhtm", Destination:=Range("A1"))
  18.             .WebFormatting = xlWebFormattingNone
  19.             .Refresh BackgroundQuery:=False
  20.             .Delete
  21.             End With
  22.         End If
  23.         Row = Row + 1
  24.         Num = ""
  25.     Loop
  26. End Sub
½Æ»s¥N½X
µ²ªG°ÝÃD¤S¥X²{¤F¡A²Ä¤@¤äªÑ²¼3474«Ü¶¶§Q¦a¸g¥ÑIF»yªk§PÂ_¶·¦A¦¸¶×¤J²Ä¤GºØºô­¶¡A¤]¥¿±`¶×¤J¡A¥i¬O²Ä¤G¤äªÑ²¼4938¡A«o¦bIFªº§PÂ_¦¡¤¤¸õ¥X¿ù»~°T®§

°õ¦æ¶¥¬q¿ù»~'1004'   À³¥Îµ{¦¡©Îª«¥ó¤Wªº©w¸q¿ù»~

¥i¬O§Ú§â¨º¬qIF¤ºªºÅÞ¿è§PÂ_¦¡Application.WorksheetFunction.IsError(Application.WorksheetFunction.Search("¬dµL", myRange))

§ï¦¨ISERROR(SEARCH("´Á", ªÑªFÅv¯q³ø¹S²v!B4))«á¡A©ñ¦b¤u§@ªí¤º«o¬O¥i¥H¥¿±`°õ¦æªº¡AÅã²{True©ÎFalseªº

·Q¦A½Ð°Ýjoey0415¤j¤j¡A³o²Õµ{¦¡½X¨ì©³¦b­þ¸Ì¥X¤F°ÝÃD©O¡H·PÁÂÀ°¦£¡I¡I

TOP

¦^´_ 5# GBKEE

·PÁÂGBKEE¶WªOªºÀ°¦£¡A¤§«eªº°ÝÃD¤j­P¤W¤w¸g¸Ñ¨M¤F¡A¥u³Ñ¤U6#©Ò´y­zªº°ÝÃD¡A¤£ª¾¹D±z¦³¦ó¸Ñªk¡H

ÁöµM¤£¬O¨Ï¥Î±z¤§«e©Ò´£¨Ñªº¡A¦ýÁÙ¬O­n·PÁ±zÄ@·Nªá®É¶¡¨ó§U¡A·P®¦¡I

¤£ºÞ¬O±z©Îjoey0415¤j¤j¼gªº¡A³£¬O§Ú­n¥h§â¥¦­Ì¬ã¨s²M·¡ªº¡A­ì¨Ó¤@¼Ëªº¥Øªº«o¥i¥H¦³ºIµM¤£¦Pªº¼gªk¡A¬Ý¨Ó§Ú­n¾ÇªºªF¦èÁÙ¯u¤£¤Ö¡I

TOP

¦^´_ 7# chingmac
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Num As String, Row As Integer
  4.     Row = 5
  5.     With Worksheets("ªÑªFÅv¯q³ø¹S²v") '.Activate
  6.     '  Do While Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value <> ""
  7.         'Num = Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value
  8.         Num = 3474
  9.         With .QueryTables.Add(Connection:= _
  10.             "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_" & Num & ".djhtm", Destination:=Range("A1"))
  11.             .WebFormatting = xlWebFormattingNone
  12.             .Refresh BackgroundQuery:=False
  13.             .Delete
  14.         End With
  15.         If .Range("B4") Like "¬dµL*¸ê®Æ" Then
  16.             With .QueryTables.Add(Connection:= _
  17.                 "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & Num & ".djhtm", Destination:=Range("A1"))
  18.                 .WebFormatting = xlWebFormattingNone
  19.                 .Refresh BackgroundQuery:=False
  20.                 .Delete
  21.             End With
  22.         End If
  23.        ' Row = Row + 1
  24.    ' Loop
  25.    End With
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# GBKEE

¦A¦¸·PÁÂGBKEE¶WªOªºÀ°¦£¡A§R°£±zªº²Ä¤K¦æµ{¦¡¸ò²Å¸¹ ' ¤§«á(§Ú²q±zÀ³¸Ó¬O´ú¸Õµ{¦¡ªº®É­Ô¨Ï¥Îªº)¡Aµ{¦¡°õ¦æ¤S¥X¤F°ÝÃD

³o¦¸¤£¬Oµ{¦¡ªº¿ù»~¡A§Úı±oÀ³¸Ó¬OExcelªº­­¨î

¤j¬ù°õ¦æ¨ì²Ä29¤äªÑ²¼ªº®É­Ô¡Aµ{¦¡´N¥X²{"°õ¦æ¶¥¬q¿ù»~'1004'   À³¥Îµ{¦¡©Îª«¥ó¤Wªº©w¸q¿ù»~"ªº°T®§

¬d¬Ý¶]¥X¨Óªºµ²ªG«á¡Aµo²{¤u§@ªí¥u¯à¶]¨ì²ÄIV¦æ´N¥X²{¿ù»~¤F¡A·Q­n¦A¥[¤W¤@¦æ³£¤£¦æ¤F¡A©Ò¥HÀ³¸Ó¬OExcelªº­­¨î

¦]¦¹§Ú·QÅýµ{¦¡¦b¶]§¹10¤äªÑ²¼¤§«á¡A¦b³Ì¤W­±´¡¤J45¦C(¦]¬°¸ê®Æªº½d³ò¬O©T©wªº)¡A§â«e10¤äªº¸ê®Æ±qÀ½¨ì²Ä47¦C¤§«á

Åý²Ä11¨ì20¤äªÑ²¼¦A±qB2¶}©l¶×¤J¡C¦ý¬O¨S·Q¨ì¡Aºô­¶¶×¤Jªº¤è¦¡¦n¹³¬O¥H¾ã¦æªº¤è¦¡¶×¤J¡A°£¤F²Ä11¤ä¨Ä¨Ä¦a­è¦n¦b²Ä10¤äªº¤W¤è¥H¥~

12¨ì20¤äªº¸ê®Æ¶×¤J®É¡A·|¥H¾ã¦æªº¤è¦¡±N²{¦³¸ê®Æ¥þ³¡©¹¥k²¾¡A¤£¬O§Ú¥»¨Ó·Q¹³ªº¥u±N²Ä11¤äªº¸ê®Æ©¹¥k²¾¦Ó¤w

§Ú¥Ø«e¼g¨ìªºµ{¦¡½X¦p¤U
  1. Sub ex()
  2.     Dim Num As String
  3.     Row = 5
  4.     Worksheets("ªÑªFÅv¯q³ø¹S²v").Activate
  5.     Cells.ClearContents
  6.     N = 0
  7.     Do While Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value <> ""
  8.         Num = Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(Row, 2).Value
  9.         With ActiveSheet.QueryTables.Add(Connection:= _
  10.         "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_" & Num & ".djhtm", Destination:=Range("A1"))
  11.         .WebFormatting = xlWebFormattingNone
  12.         .Refresh BackgroundQuery:=False
  13.         .Delete
  14.         End With
  15.         If (Worksheets("ªÑªFÅv¯q³ø¹S²v").Cells(4, 2) Like "¬dµL*¸ê®Æ") Then
  16.             Columns(2).Select
  17.             Selection.ClearContents
  18.             With ActiveSheet.QueryTables.Add(Connection:= _
  19.             "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & Num & ".djhtm", Destination:=Range("A1"))
  20.             .WebFormatting = xlWebFormattingNone
  21.             .Refresh BackgroundQuery:=False
  22.             .Delete
  23.             End With
  24.         End If
  25.         N = N + 1
  26.         If (N / 10 = Int(N / 10) And N < 50) Then
  27.            Rows("2:46").Insert Shift:=xlDown
  28.         End If
  29.         Row = Row + 1
  30.         Num = ""
  31.     Loop
  32. End Sub
½Æ»s¥N½X
§Ú§â°õ¦æªºµ²ªGµe¤F¤@±i²¤¹Ï¦p¤U



¤£ª¾­n«ç»ò­×§ï¤ñ¸û¦n¡H¦³¿ìªkÅýºô­¶¶×¤Jªº®É­Ô¤£­n¥H¾ã¦æªº¤è¦¡±N©Ò¦³¸ê®Æ¦V¥k²¾¶Ü¡H·PÁ¦U¦ìªºÀ°¦£¡I

TOP

¦^´_ 9# chingmac

¯uªº«D±`·PÁÂGBKEE¶WªO¸òjoey0415¤j¤jªº¼ö¤ßÀ°¦£¡A§â§Ú­nªºµ{¦¡½X­×§ï§¹¦¨¤F¡A#9ªº°ÝÃD¦]¬°Excelªº­­¨î¤Îºô­¶¶×¤J®æ¦¡ªºÃö«Y

³Ì«á§âµ{¦¡­×§ï¦¨ª½¦æ¶×¤Jªº§Î¦¡¡A¥Ñ¤W©¹¤U¶×¤J¨C¤äªÑ²¼¡A¥ý¶×¤JªºªÑ²¼¤£·|¦]¬°«á­±ªÑ²¼ªº¶×¤J¦Ó²£¥Í¦ì²¾ªº±¡§Î¡A¤]¤£·|¦³¤£°÷ªº°ÝÃD

(office2003¤u§@ªí³Ì¦h¥i¥H¦³65536¦C)¡A¸g¹L´ú¸Õ¡A²×©ó¥X²{»Ý­nªº¸ê®Æ¤F¡Aµ{¦¡½X¦p¤U¡Aµ¹¦³Ãþ¦ü»Ý­nªº¤H°µ°Ñ¦Ò¡I
  1. Sub ex()
  2.     Dim Num As String
  3.     R = 5
  4.     Worksheets("ªÑªFÅv¯q³ø¹S²v").Activate
  5.     Cells.ClearContents
  6.     N = 0
  7.     Do While Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(R, 2).Value <> ""
  8.         Row = N * 48 + 1
  9.         Num = Worksheets("¥xÆW50¦¨¤ÀªÑ").Cells(R, 2).Value
  10.         With ActiveSheet.QueryTables.Add(Connection:= _
  11.         "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr_" & Num & ".djhtm", Destination:=Range("A" & Row))
  12.         .WebFormatting = xlWebFormattingNone
  13.         .Refresh BackgroundQuery:=False
  14.         .Delete
  15.         End With
  16.         If (Worksheets("ªÑªFÅv¯q³ø¹S²v").Cells(Row + 3, 2) Like "¬dµL*¸ê®Æ") Then
  17.             Range(Cells(Row, "A"), Cells(Row + 45, "C")).Select
  18.             Selection.ClearContents
  19.             With ActiveSheet.QueryTables.Add(Connection:= _
  20.             "URL;http://jsjustweb.jihsun.com.tw/z/zc/zcr/zcr0_" & Num & ".djhtm", Destination:=Range("A" & Row))
  21.             .WebFormatting = xlWebFormattingNone
  22.             .Refresh BackgroundQuery:=False
  23.             .Delete
  24.             End With
  25.         End If
  26.         R = R + 1
  27.         N = N + 1
  28.         Num = ""
  29.     Loop
  30. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD