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

[µo°Ý] ¥N½XÀ³¸Ó¦p¦ó¼¶¼g¤~¯à©¿µø ¦]¬d¸ß¤£¨ì¦Ó²£¥Íªººô­¶°T®§©O¡H

¦^´_ 10# joey0415
¤j·§´N¬O½T»{IE¬O§_¦³¥ô¦ó¤lµøµ¡Åã¥Ü(ex:°T®§µøµ¡)¡A¦³´N±NIE¤Á´«¦¨³Ì¤W¼hÅã¥Ü«á¦A°e¥XENTERÁä±N°T®§µøµ¡Ãö³¬¡C
³]©w­È½Ð°Ñ¦Ò¤U¦Cºô§}:
https://msdn.microsoft.com/zh-tw/ms633515
¥t¥~§Ú¼gªº¹L©ó²¤Æ¡A³]·Q¦pªGµo¥Í¤lµøµ¡µLªk¥ÎENTERÁäÃö³¬ªº±¡ªp¡A§A³Ì¦n¥[¤W¿ù»~³B²z¾÷¨î(ex:°e¥XENTERÁä´X¦¸µL®Ä«á´N¤£¦A°õ¦æ§ïÅã¥Ü¿ù»~°T®§)¡A¤£µM¦³¥i¯à·|¶i¤J¦º°j°é...

TOP

¦^´_ 11# azrael19

­Y§ï¦¨³o¼Ëªººô­¶¡AÁöµM¥i¥HÂIÀ»¡A¦ý¤§«á«o¥¢µJ¤F¡A¦pªG­«·s¦A©¹¤UÂIÀ»©O¡H
ÁÂÁÂ

·PÁ«üÂI
  1. Sub ÂIÀ»()
  2.     Cells.Clear
  3.     Dim lHwndChild&
  4.     Set ie = CreateObject("InternetExplorer.Application")
  5.     With ie
  6.         .Visible = True
  7.         .Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
  8.         
  9.                 Do While .Busy Or .ReadyState <> 4  'µ¥­Ôºô­¶¤U¸ü§¹²¦
  10.                     DoEvents
  11.                  Loop
  12.         Set x = .document.all.tags("option") '¬d¤U©Ô¿ï³æ
  13.             x(7).Selected = True '¿ï¨ú¸Ó¤l¶µ¥Ø
  14.             
  15.             .document.getElementsByName("StockNo")(0).Value = "6456"
  16.             .document.getElementsByName("sub")(0).Click

  17.         Sleep 2000

  18.             lHwndChild = GetWindow(.HWND, GW_CHILD)

  19.               If lHwndChild <> 0 Then
  20.                 Do While lHwndChild
  21.                     SetForegroundWindow .HWND 'HWND is the HWND of the myIEWindow
  22.                     Application.SendKeys "~", True
  23.                     
  24.                     lHwndChild = GetWindow(lHwndChild, GW_HWNDNEXT)
  25.                 Loop
  26.                
  27.                 Sleep 2000
  28.             End If
  29.                         '-------------------¥H¤U¬°¥¢µJ³B¡AµLªkÂIÀ»
  30.             Stop
  31.             .document.getElementsByName("StockNo")(0).Value = "1101"
  32.             .document.getElementsByName("sub")(0).Click
  33.             
  34.         Do While .Busy Or .ReadyState <> 4  'µ¥­Ôºô­¶¤U¸ü§¹²¦
  35.             DoEvents
  36.          Loop

  37.         Stop
  38.         .Quit
  39.     End With   

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

TOP

¦^´_ 12# joey0415
§Ú¥Î§A¤W­±¶Kªºµ{¦¡½X¤ÎGBKEEª©¥D±Ðªº¤èªk³£¨S¦³¥X²{°ÝÃD(¥Î Win7 + IE11 + Office2013),©Ò¥H§Ú¤]¤£¾å±o¥X¤F¤°»ò°ÝÃD...
³o°ÝÃD¦pªGµu®É¶¡¤ºµLªk¸Ñ¨M§A¤S«æ»Ý³o¨Ç¸ê®Æ,¤U¦Cºô§}¥i¥H§ì¨ì³Ì·s¤@´Áªº¸ê®Æ(csvÀÉ):
http://data.gov.tw/node/11452

TOP

¦^´_ 13# azrael19

¶W¯Å·PÁ±zªº¦^µª

§Ú¦³¨â¥x¹q¸£

¤@¥x win7 64¦ì¤¸  office 2010 32¦ì¤¸  IE 11 32¦ì¤¸ ¤£¦æ

¤@¥x win7 64¦ì¤¸  office 2010 32¦ì¤¸  IE 10 32¦ì¤¸ ¥i¥H

¨ä¹ê§ìªº¤èªk§Ú·|¡A¥u¬O­n¦h¾Ç¤@ºØ

·PÁ±оǬ۪ø

TOP

¦^´_ 14# joey0415
¥t¤@ºØ¤è¦¡,¸Õ¸Õ¬Ý...
  1. Option Explicit

  2. #If Win64 Then
  3. Private Declare PtrSafe Function GetWindow Lib "USER32" (ByVal hWnd As LongPtr, ByVal wCmd As LongPtr) As LongPtr
  4. Private Declare PtrSafe Function SetForegroundWindow Lib "USER32" (ByVal hWnd As Long) As Long
  5. Private Declare PtrSafe Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
  6. Private Declare PtrSafe Function FindWindowEx Lib "USER32" Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
  7. Private Declare PtrSafe Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
  8. #Else
  9. Private Declare Function GetWindow Lib "user32" (ByVal HWND As Long, ByVal wCmd As Long) As Long
  10. Private Declare Function SetForegroundWindow Lib "user32" (ByVal HWND As Long) As Long
  11. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  12. Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  13. Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
  14. #End If

  15. Private Const WM_CLOSE = &H10
  16. Private Const GW_HWNDNEXT = 2
  17. Private Const GW_CHILD = 5
  18. Private Const BM_CLICK = &HF5

  19. Sub ÂIÀ»()
  20.     Cells.Clear
  21.     Dim hWndChild, hWndPopup, x, Retries As Integer: Retries = 10
  22.    
  23.     With CreateObject("InternetExplorer.Application")
  24.         .Visible = True
  25.         .Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
  26.         
  27.         Do While .Busy Or .ReadyState <> 4  'µ¥­Ôºô­¶¤U¸ü§¹²¦
  28.             DoEvents
  29.         Loop
  30.         Set x = .document.all.tags("option") '¬d¤U©Ô¿ï³æ
  31.         x(7).Selected = True '¿ï¨ú¸Ó¤l¶µ¥Ø
  32.         
  33.         .document.getElementsByName("StockNo")(0).Value = "6456"
  34.         .document.getElementsByName("sub")(0).Click
  35.         
  36.         Do While (.Busy Or .ReadyState <> 4) And 0 < Retries
  37.         
  38.             hWndChild = GetWindow(.hWnd, GW_CHILD)
  39.         
  40.             If 0 <> hWndChild Then
  41.                 Do While hWndChild
  42.                     hWndPopup = FindWindow("#32770", "ºô­¶°T®§") '#32770 The class for a dialog box
  43.                     If 0 <> hWndPopup Then
  44.                         SendMessage FindWindowEx(hWndPopup, 0, "Button", "½T©w"), BM_CLICK, 0, 0
  45.                     Else
  46.                         Exit Do
  47.                     End If
  48.                     'SetForegroundWindow .hWnd 'HWND is the HWND of the myIEWindow
  49.                     'Application.SendKeys "~", True
  50.                     hWndChild = GetWindow(hWndChild, GW_HWNDNEXT)
  51.                 Loop
  52.             
  53.             End If
  54.             Application.Wait Now + #12:00:01 AM#
  55.             DoEvents
  56.             Retries = Retries - 1
  57.         Loop
  58.         If 0 = Retries Then
  59.             AppActivate Application.Caption
  60.             MsgBox "µLªkÃö³¬°T®§µøµ¡!", vbCritical
  61.             Exit Sub
  62.         End If
  63.         '-------------------¥H¤U¬°¥¢µJ³B¡AµLªkÂIÀ»
  64.         Stop
  65.         .document.getElementsByName("StockNo")(0).Value = "1101"
  66.         .document.getElementsByName("sub")(0).Click
  67.             
  68.         Do While .Busy Or .ReadyState <> 4  'µ¥­Ôºô­¶¤U¸ü§¹²¦
  69.            DoEvents
  70.         Loop
  71.         
  72.         Stop
  73.         .Quit
  74.     End With

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

TOP

¦^´_ 15# azrael19
¦^ÂСI³o­Ó¤]¥i¥H®@¡I

§Ú¦Û¤vµo²{§Ú³o¥xªºie¬O11ª© 64¦ì¤¸ªº¡A©Ò¥H¤§«eªº³£µL®Ä
²¾°£«á¡AÁöµM µLªk§ï¸Ë¦¨11ª© 32¦ì¤¸¡A¨t²Î¬°64¦ì¤¸ªº
¥u¦n¥Î10ª©ªº¡A¤£¹L´N¥i¥H°Õ

§Ú·Q¤@©w¬Oie¬O11ª© 64¦ì¤¸ªºÃö«Y¡A¦³¬Y¨Ç¨ç¦¡¤£¯à¥Î

ÁÂÁÂ

¦³ªÅ¥[­Ó¦n¤Í

½Ð°Ý  "#32770"  ±q­þ¬Ý¥X¨Óªº

TOP

¦^´_ 16# joey0415


"#32770" ¥Î  vbNullString ´À¥N§Y¥i

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD