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

[µo°Ý] vba§PÂ_¬O§_¤wµn¤Jºô­¶

[µo°Ý] vba§PÂ_¬O§_¤wµn¤Jºô­¶

½Ð°Ý¸Ó¦p¦ó¦b¥H¤Uµ{¦¡½X¥[¤J§PÂ_¦¡±ø¥ó§PÂ_¦pªG¶i¤Jµn¤Jºô§}http://10.178.1.140:8023/Login.aspx®É¡A¦pªG§ä¤£¨ìµn¤Jid"txtUserName"¡A«hª½±µ¸õ¦Ü¬d¸ß¼Æ¾Úºô§}http://10.178.1.140:8023/ConditionPage/ConditionAgentDay.aspx¡A¨ÃÄ~Äò©¹¤U°õ¦æ


¦pªG¥¼µn¤J®É¡A«h¥Ñ¤W¦Ü¤U¦Û°Ê°õ¦æ
----------------------------------------------------------------
Sub ¦Û°Êµn¤J()
Dim a As Object
Set myIE = CreateObject("InternetExplorer.Application")
With myIE
  .Visible = False
  .Navigate "http://10.178.1.140:8023/Login.aspx" 'µn¤Jºô§}  <<<¶i¤Jµn¤Jºô§}®É

     Do While .ReadyState <> 4
        DoEvents
     Loop

Set a = .document.all.tags("INPUT")
  .document.all.txtUserName.innertext = "XXXXX" 'µn¤J±b¸¹  <<<¦pªG§ä¤£¨ìµn¤Jid¡A«hª½±µ¶i¤J¬d¸ß¼Æ¾Úºô§}
  .document.all.txtPassword.innertext = "XXXXX" 'µn¤J±K½X
  .document.all.btnLogin.Click 'ÂI¿ïµn¤J«ö¶s

     Do Until .ReadyState = 4
        DoEvents
     Loop

  .Navigate "http://10.178.1.140:8023/ConditionPage/ConditionAgentDay.aspx" '¬d¸ß¼Æ¾Úºô§}

  ........µ{¦¡½X......
*¦v¤k¤@ªTµL»~*

¦^´_ 9# GBKEE


   ¹ï¤F!!§Ñ°O¸ò§A»¡¡A«D±`·PÁÂ~~~~~~~~¤S¸Ñ¨M¤F¤@­Ó§Úº¡¸£¤lªº°ÝÃD!!!!
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 9# GBKEE


   G¤j¹ï¤£°_~~~~~§Ú¬Ý¨ì²Ä¤@¬q³Æµù¤F'½Ð¥ý±N±M®× [³]©w¤Þ¥Î¶µ¥Ø]¥[¤J  Microsoft Internet Controls

¨S¨Æ~~~¨S¨Æ~~~
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 9# GBKEE


   G¤j~~~½Ð°Ý°õ¦æ®É²Ä3¬q Dim myIE As New InternetExplorer ¥X²{¿ù»~°T®§¡u¨Ï¥ÎªÌ¦Û­q«¬ºA©|¥¼©w¸q¡v¬O¬°¤°»ò©O??
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 8# msmplay
  1. '½Ð¥ý±N±M®× [³]©w¤Þ¥Î¶µ¥Ø]¥[¤J  Microsoft Internet Controls
  2. Option Explicit
  3. Dim myIE As New InternetExplorer
  4. Const myURL = "http://forum.twbts.com/my.php?item=threads" '§Úªº©«¤l¤À­¶
  5. Sub TEST()
  6.     'Set myIE = CreateObject("InternetExplorer.Application")
  7.     With myIE
  8.         .Visible = True
  9.         .Navigate "http://forum.twbts.com/index.php" '¶i¤J³Â»¶®a±Ú°Q½×°Ï
  10.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  11.         .Document.all.mycredits.Click 'ÂI¿ï¶i¤J§Úªº©«¤l¡A¦ý¶}±Òºô­¶®É¬O¦Û°Ê¶}±Ò¤@­Ó·sªº¤À­¶¡A¦Ó¥Bµe­±¤£·|¦Û°Ê¤Á´«¨ì·s¤À­¶­¶ÅÒ(µe­±¤´°±¯d¦b­ì­¶­±)
  12.         Do:     DoEvents:         Loop Until InStr(.Document.BODY.INNERTEXT, " §Úªº©«¤l")
  13.     End With
  14.     IE_Function
  15.     ''§Úªº©«¤l¤À­¶¤¤-- Âಾ¤À­¶ºô§}
  16.     With myIE
  17.          .Navigate "http://forum.twbts.com/thread-20650-1-1.html"
  18.           Do While .Busy Or .readyState <> 4: DoEvents: Loop
  19.     End With
  20. End Sub
  21. Private Function IE_Function()
  22.     Dim shell_windows As New SHDocVw.ShellWindows
  23.     Dim IE As SHDocVw.InternetExplorer
  24.     Dim objShell As Object
  25.     Set myIE = Nothing
  26.     Set objShell = CreateObject("shell.application")
  27.     If objShell.Windows.Count = 0 Then  '¨¾§b   :  Ie ¨S¦³¶}±Ò
  28.         Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE", 2  ' (2  À³¥Îµ{¦¡µøµ¡·|¥H¤@­Ó¹Ï¥Ü¨ÓÅã¥Ü¡A¨Ã¨ã¦³¾nÂI)
  29.         MsgBox "½Ðµ¥­Ô ie ¶}±Ò§¹²¦": End
  30.     End If
  31.     For Each IE In shell_windows
  32.         With IE
  33.             Do While .Busy Or .readyState <> 4:         Loop
  34.             If .LocationURL = myURL Then
  35.                 Set myIE = IE
  36.                Exit Function
  37.             End If
  38.         End With
  39.     Next
  40. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# GBKEE

   G¤j~~¶W¯Å·PÁ¡A¤£¹L¥i¥H¦A¸ò§A½Ð±Ð³Ìªñ¹J¨ìªº°ÝÃD¶Ü~~~~¥H¤U¬O´ú¸Õ¨BÆJ¡A¥D­nµo¥Í°ÝÃD¬O¦b¬õ¦â³¡¥÷
Sub TEST()
Set myIE = CreateObject("InternetExplorer.Application")
With myIE
  .Visible = True
  .Navigate "http://forum.twbts.com/index.php" '¶i¤J³Â»¶®a±Ú°Q½×°Ï
  Do While .Busy Or .readyState <> 4: DoEvents: Loop


  .document.all.mycredits.Click 'ÂI¿ï¶i¤J§Úªº©«¤l¡A¦ý¶}±Òºô­¶®É¬O¦Û°Ê¶}±Ò¤@­Ó·sªº¤À­¶¡A¦Ó¥Bµe­±¤£·|¦Û°Ê¤Á´«¨ì·s¤À­¶­¶ÅÒ(µe­±¤´°±¯d¦b­ì­¶­±)
  Application.Wait Now + TimeValue("0:00:2") 'µ¥«Ý2¬í
  .Navigate "http://forum.twbts.com/my.php?item=threads" '¶i¤J§Úªº©«¤l(¨Ï¥Î­ì­¶­±Âà´«¨ì§Úªº©«¤l¡A«D¤Á´«¨ì¤À­¶)
  Application.Wait Now + TimeValue("0:00:2") 'µ¥«Ý2¬í
  .document.all.mn_viewthread_1.Click 'ÂI¿ï¶i¤J½×¾Âª©³W
End With
End Sub



°ÝÃD1. ¦]¬°¤½¥q¨Ï¥ÎIE8¡A¨C¤H¹q¸£³t«×§ÖºC¤£¤@¡A¥H¤U°õ¦æµ²ªG¦³¤H¹q¸£ºC´N·|¶]¨ì³Ì«á¤@¨BÂI¿ï¶i¤J½×¾Âª©³W®Éµo¥Í¿ù»~¡A¦]¬°¤W¤@¨B¶i¤J§Úªº©«¤lºô­¶®Ú¥»ÁÙ¨S¶]¥X¨Ó(ÁÙ¦bÂà)¡Aµ¥«Ý2¬í¹ï¥L­Ì¦Ó¨¥ºâ¤Ó§Ö¡A¦ý¹ï¹q¸£§Öªº¤H¦pªGµ¥«Ý2¬í¥H¤W¤Sı±o¤ÓºC
·Q½Ð°Ý¦³¤°»ò¿ìªk¥i¥H¦Û°Ê°»´úºô­¶¬O§_¤w¹B¦æ§¹¦¨¦A°õ¦æ¤U¤@¨B¶Ü¡H¦Ó¤£¬O¥Î©T©w¬í¼Æ­p®É¡C


°ÝÃD2. ¦]¬°ÂI¿ï¶i¤J§Úªº©«¤l®É¡A¤½¥qªºIE8¶}±Òºô­¶®É¬O¦Û°Ê¶}±Ò¤@­Ó·sªº¤À­¶¡A¦ýµe­±¤£·|¦Û°Ê¤Á´«¨ì·s¤À­¶­¶ÅÒ(µe­±¤´°±¯d¦b­ì­¶­±)
·Q½Ð°Ý¦³¤°»ò¤è¦¡¥i¥H¦bÂI¿ï¶i¤J§Úªº©«¤l«áµe­±¦Û°Ê¤Á´«¨ì·s¤À­¶­¶ÅÒ¡AÂæ¤]´N¤£¥Î¦A¦h¤@¨B  .Navigate "http://forum.twbts.com/my.php?item=threads" '¶i¤J§Úªº©«¤l(¨Ï¥Î­ì­¶­±Âà´«¨ì§Úªº©«¤l¡A«D¤Á´«¨ì¤À­¶) ¤F
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 6# msmplay
  1. Option Explicit
  2. Const ¥Î¤á¦WºÙ = "msmplay"
  3. Const ¥Î¤á±K½X = "­×§ï¬°§Aªºµn¤J±K½X"
  4. Private Sub Ex()
  5.     If µn¿ý¬d¬Ý = False Then µn¿ý
  6. End Sub
  7. Private Function µn¿ý¬d¬Ý() As Boolean
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Navigate "http://forum.twbts.com/task.php?item=done"
  10.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  11.         µn¿ý¬d¬Ý = InStr(.Document.BODY.innertext, ¥Î¤á¦WºÙ)
  12.         .Quit        'Ãö³¬ºô­¶
  13.     End With
  14. End Function
  15. Private Sub µn¿ý()
  16.     Dim i As Variant, vDoc As Object
  17.     With CreateObject("InternetExplorer.Application")
  18.         ' .Visible = True
  19.         .Navigate "http://forum.twbts.com/logging.php?action=login"
  20.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  21.         Set vDoc = .Document.getElementsByTAGName("INPUT")
  22.         For i = 0 To vDoc.Length - 1
  23.             If vDoc(i).Name = "username" Then vDoc(i).Value = ¥Î¤á¦WºÙ
  24.             If vDoc(i).Name = "password" Then vDoc(i).Value = ¥Î¤á±K½X: Exit For
  25.         Next
  26.         Set vDoc = .Document.getElementsByTAGName("input") '.Click
  27.         For i = 0 To vDoc.Length - 1
  28.             If vDoc(i).Type = "checkbox" Then vDoc(i).Click: Exit For
  29.         Next
  30.         Set vDoc = .Document.getElementsByTAGName("button") '.Click
  31.         For i = 0 To vDoc.Length - 1
  32.             If vDoc(i).Name = "loginsubmit" Then vDoc(i).Click: Exit For
  33.         Next
  34.         i = Time
  35.         Do
  36.             DoEvents
  37.             If Time > i + #12:00:30 AM# Then MsgBox .Document.Title & vbLf & " µn¤J¥¢±Ñ !": .Quit: End
  38.         Loop Until InStr(.Document.BODY.innertext, ¥Î¤á¦WºÙ)
  39.         .Quit
  40.     End With
  41. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 5# jcchiang    j¤j~~~§Ú¥[¤J¥H¤U¬õ¦âµ{¦¡½X¦¨¥\¸Ñ¨M°ÝÃD¤F¡A·PÁ¼ö¤ß¦^ÂУ¬¡I¡I¡I

Sub ¦Û°Êµn¤J()
On Error GoTo ErrorHandler
Dim a As Object
Set myIE = CreateObject("InternetExplorer.Application")
With myIE
  .Visible = False
.Navigate "http://10.178.1.140:8023/Login.aspx" 'µn¤Jºô§}

     Do While .ReadyState <> 4
        DoEvents
     Loop

Set a = .document.all.tags("INPUT")
  .document.all.txtUserName.innertext = "XXXXX" 'µn¤J±b¸¹
  .document.all.txtPassword.innertext = "XXXXX" 'µn¤J±K½X
  .document.all.btnLogin.Click 'ÂI¿ïµn¤J«ö¶s

     Do Until .ReadyState = 4
        DoEvents
     Loop

ErrorHandler:
  .Navigate "http://10.178.1.140:8023/ConditionPage/ConditionAgentDay.aspx" '¬d¸ß¼Æ¾Úºô§}

  ........µ{¦¡½X......
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 4# msmplay
©p¥ý¬d¬Ý­ì©l½X,¥¼µn¤J & ¤wµn¤J txtUserName.innertext ¤ºªº¦r¤¸¬O§_¦³¤£¤@¼Ë
¦p¤wµn¤JªºtxtUserName.innertext ¤w¦³µn¤J±b¸¹,´N¥i¥H§P§O¦p¤w¦³±b¸¹´N¸õ¦Ü¬d¸ßºô­¶

TOP

¦^´_ 3# jcchiang


   j¤j¹ï¤£°_¡A¥i¯à¸ò§Ú¤£À´µ{¦¡½XÅ޿観Ãö¡A¥Ø«e¹J¨ì°ÝÃD¬O¡A¦pªG·ÓµÛµ{¦¡½X¥Ñ¤W©¹¤U°õ¦æ=µn¤Jºô­¶>°õ¦æµn¤J>Âà´«¨ì¬d¸ßºô­¶>°õ¦æ¨ä¥L°Ê§@¡C¦ý¦pªG·í¤Ñ¤w¸g°õ¦æ¹L¤@¦¸©Î¤w¸gµn¤J«á»Ý­n¦A°õ¦æ¤@¦¸¥H¤Wµ{¦¡½X¡A´N·|°õ¦æ¨ì.document.all.txtUserName.innertext = "XXXXX" 'µn¤J±b¸¹ ¥X²{¿ù»~°T®§


¦]¬°¤w¸g¬Oµn¤Jª¬ºA¡A§Y«K¿é¤Jµn¤Jºô§}.Navigate "http://10.178.1.140:8023/Login.aspx" 'µn¤Jºô§}


¨t²Î£®·|¦Û¤vÂà´«¨ì"http://10.178.1.140:8023/ConditionPage/ConditionAgentDay.aspx" '¬d¸ß¼Æ¾Úºô§}¡A¦]¦¹¦b¬d¸ßºô§}­¶­±¥Ñ¤W¦Ü¤U°õ¦æµn¤J°Ê§@´N·|¥X²{²§±`¡C


·Q½Ð°Ý¦³¤°»ò¤è¦¡¥i¥H§PÂ_£¸¶}©l¶i¤Jµn¤Jºô­¶®É¡A¦pªGª½±µÂà´«¨ì¬d¸ßºô­¶¥Nªí¤w¸gµn¤J¹L¤F¡A´Nª½±µ©¹¬d¸ß¼Æ¾Úºô§}¥H¤Uµ{¦¡Ä~Äò°õ¦æ¡C


§Ú¬O³o­Ó·N«ä°Õ¡I¤£·|ªí¹F©Îªí¹F¿ù»~½Ð­ì½Ì~~~
*¦v¤k¤@ªTµL»~*

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD