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

¨Ï¥ÎVBA§ì¨úºô­¶¸ê®Æ¡A¤j¬ù¤£¨ì5µ§´N·|·í±¼¡A¨D¸Ñ

¨Ï¥ÎVBA§ì¨úºô­¶¸ê®Æ¡A¤j¬ù¤£¨ì5µ§´N·|·í±¼¡A¨D¸Ñ

¥»©«³Ì«á¥Ñ clio ©ó 2019-8-23 14:38 ½s¿è

¦U¦ì«e½ú¡A
¤p§Ì§Ú»Ý­n¦b§Q¥ÎDigiKey¨Ó§@¸ê®Æ¤ñ¹ïªº¤u§@¡A·í§ì¨ì¦³¬Û²Åªº¸ê®Æ¡A·|±N¤@¨Ç¸ê®Æ°O¿ý¤U¨Ó¡A¦ý¬O¤§«e§Q¥ÎVBA§ìºô­¶ªºµ{¦¡¦³Àò¡iGBKEE¡j¤j¤jªº«ü¾É­×§ï¤F¡A¦ý¬O¥Ø«e¦]¬°³sµ²ªº¦aÂI¤£¦P¡A¤]µo²{³ºµM¶]¨ì²Ä¤­µ§´N·í®Æ¡A¯S¦a¤W¨Ó¨D¸Ñ¡AÁٽе¹¤p§Ì¤@¨Ç«Øij¡A·PÁ±z¡C
¤p§Ì·|¥Î¬¡­¶¡iPN List¡j¤ºªºBÄ椺¸ê®Æ¬°Key­È¥h¥N¤Jºô­¶§ì¨ú¸ê®Æ
§ìºô­¶¸ê®Æµ{¦¡_D1.zip (38.53 KB)
clio

¦^´_ 1# clio
¥u§ì
https://www.digikey.tw/products/en?keywords=%22CRL2010-JW-1R00ELF-ND%22

³Ñ¤U½Ð¦Û¦æ­×§ï
test.zip (15.43 KB)

TOP

¦^´_ 2# joey0415

Hi Joey0415,
¤p§Ì´ú¸Õ¹L¤F¡A¥i¥H°õ¦æ¤@µ§¡A¦ý¬O¦]¬°¬O¤ñ¹ï¸Ó®Æ¬O§_¦bDigikeyªº¸ê®Æ®w¤º¡A©Ò¥H·|¦³¤ñ¹ï­è¦n¤@µ§¡A¦hµ§¡A»P§ä¤£¨ìªº±¡ªp¡A§Ú­ì¥ýªºµ{¦¡¡A¦³¦Ò¶q³o¨Ç±¡ªp¤À§O§@¤£¦P³B¸m¡A¦ý¬O±zªº³o­Óµ{¦¡¡A¥u¯à§ä¨ì¦³¶]¥XTableªºªí®æªº¡A©Ò¥H·|¦³·í¾÷ªº±¡ªp»¡¡A¬O§_ÁÙ¦³§ïµ½¤è¦¡©O¡H·PÁ±z¡C
¡iTD62597AFG¡j§ä¤£¨ì¸ê®Æ
¡iULN2003AFWG¡j§ä¨ì¦hµ§¸ê®Æ
clio

TOP

¦^´_ 3# clio

¤@µ§¡A¦hµ§¡AµL¸ê®Æ¡A¥i¥Îºô­¶¤W¦³´X­Ótable§PÂ_

¤U¤è¬O¦hµ§
  1. Sub test()
  2.     Cells.ClearContents
  3.     '³]©w¤Þ¥Î¶µ¥Ø  microsoft html object library
  4.     Dim bPostData() As Byte
  5.     Dim URL, strurlHeaders As String
  6.     Dim i, j As Integer
  7.     Dim hDoc As New MSHTML.HTMLDocument
  8.     Dim objIE As Object
  9.     spath = ThisWorkbook.Path
  10.     URL = "https://www.digikey.tw/products/en?keywords=ULN2003AFWG"
  11. '    Stop
  12.      strurlHeaders = "Content-Type: application/x-www-form-urlencoded"
  13.     Set objIE = CreateObject("InternetExplorer.Application")
  14.     With objIE
  15.         .Visible = True
  16.         .Navigate URL, , , bPostData, strurlHeaders
  17.         Do While .readyState <> 4: DoEvents: Loop
  18.         Set hTable = .Document.getElementsByTagName("table")(0)
  19.             With ActiveSheet
  20.                 For i = 0 To hTable.Rows.Length - 1
  21.                     For j = 0 To hTable.Rows(i).Cells.Length - 1
  22.                         .Cells(i + 1, j + 1) = hTable.Rows(i).Cells(j).innerText
  23.                     Next
  24.                 Next
  25.             End With
  26.     End With
  27.     objIE.Quit
  28.     Set objIE = Nothing
  29. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# joey0415

Hi Joey,
½Ð°Ý¤@¤U§Ú«ç»ò¼Ë¥i¥Hª¾¹D³o­Óºô­¶¦³´X­ÓTable©O¡H¦³¤@­Ó­pºâªºµ{¦¡¶Ü¡H
clio

TOP

¦^´_ 5# clio

COUNT_TABLE = .Document.getElementsByTagName("table").Length

¦pªG
COUNT_TABLE =2  ¦hÄæ
COUNT_TABLE =6  ¤@Äæ
COUNT_TABLE =0  µL¸ê®Æ





TOP

¦^´_ 6# joey0415
¸U¤À·PÁÂJoeyªº¸Ô²Ó¸Ñ»¡¡A¯uªºÅý¤p§Ì§Ú¨ü¯q«Ü¦h¡A¸Ñ¨M¤F³o­Ó°ÝÃD
·Q¦A¸ò«e½ú½Ð±Ð¤@¤U¡A·í¤p§Ì§ï¦¨¨Ï¥ÎXMLHTTP¨Ó§ì¨úºô­¶¸ê®Æ®É¡A¤j¬ù60µ§¥ª¥k¡A´N·|²£¥ÍµLªk³sµ²ªº¿ù»~¡A¨äStatus¡÷403
¤p§Ì¤]¦bºô¸ô¤W¸ÕµÛ§ä´M¸Ñ¨M¿ëªk¡A¦ý¬O¥¼ªG¡A¤£ª¾¹D«e½ú¬O§_ª¾¹D¸Ñ¨Mªº¤èªk©O¡H
¦A¦¸½Ð±Ð¡A³Â·Ð±z¤F¡A·PÁ±z¡C
clio

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2019-8-29 21:10 ½s¿è

¦^´_ 7# clio

ª½±µ½Õ¥ÎApplication.Wait
VBA¤ºªºApplication Object ¦³ Wait ¥i¨Ñ¨Ï¥Î¡A­Y­n¼È°±1¬í¡A¥i½s½X¡G
Application.Wait Now + TimeValue("00:00:01")

¥[¤Wµ¥«Ý®É¶¡¸Õ¸Õ
¦³ªººô¯¸­nµ¥
¬í¼Æ¤£¤@©w

¤½¶}¸ê°T¯¸goodinfoµ¥¡Aª¦¤Ó§Ö³£·|Âêip

¦pªGÁÙ¤£¦æ
¦A½Ð¯q§Oªº°ª¤â

TOP

¦^´_ 8# joey0415

·PÁÂJoey ¡A¤p§Ì§Ú¦A¸Õ¸Õ¬Ý¡K¸U¤À·PÁ±z
clio

TOP

        ÀR«ä¦Û¦b : ¦³¦h¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD