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

[½Ð¯q] ¨Ï¥ÎEXCEL³sµ²IE§ì¨úºô­¶¸ê®Æªº°ÝÃD

[½Ð¯q] ¨Ï¥ÎEXCEL³sµ²IE§ì¨úºô­¶¸ê®Æªº°ÝÃD

¥»©«³Ì«á¥Ñ sasho ©ó 2010-6-25 19:47 ½s¿è

¥Ø«e¥¿¦b¾Ç²ß¨Ï¥Îvba³sµ²IE§ì¨ú¥~³¡¸ê®Æ

¦ý¦b¾Ç²ß¤W¹J¨ìÂI°ÝÃD,·Q¤W¨Ó½Ð±Ð¦U¦ì«e½ú,½Ð¤j®aÀ°¦£,ÁÂÁÂ!

1. ¤£¾å±oMICROSOFT HTML object libaryÀ³¸Ó­n¥h­þ¸Ì¬d¸ß©O?
    ¦]¬°¦³³\¦hÄݩʩάO¥Îªk¤Wªº°ÝÃD¤£²M·¡,¦ý«o¤S¤£ª¾¹D¦³­þÃä¥i¥H¬d¸ß,¥i¥H½Ð¦³¸gÅ窺¤H«ü¾É¤@¤U¶Ü?

2. ¦pªG§Ú·Q¦b¼gµ{¦¡ªº¹Lµ{¤¤§Q¥ÎÃþ¦ümsgboxªº«ü¥O¥h,¿é¥X§Ú§ì¨ìªºIE.document¤£¾å±o¥i¥H¥Î¤°»ò¤èªk©O?
    ¦]¬°·Q°w¹ïºô­¶¤¤ªºtable§ì,¦ý¤@­Óºô­¶¦³¦n¦h­Ótable,©Ò¥H±`±`·|³y¦¨«áÄòªº«ü¥Oªº¿ù»~,©Ò¥H·Q¦pªG¥i¥H§Q¥ÎÃþ¦ümsgboxªº¥\¯à¨Ó°µ°»¿ù!

      
ÁÂÁ¤j®a!

¦^´_ 1# sasho

³]©w¤Þ¥Î¶µ¥Øªº¥Øªº,¦b©óÅýEXCEL VBA »{ÃѨä¥LÀ³¥Îµ{¦¡ª«¥ó
©Ò¥H·í§A¤Ä¿ï¸Ó¤Þ¥Î¶µ¥Ø«á
¦bµ{¦¡°Ï¬q«Å§iÅܼƪº«¬ºA§¹¦¨«á
«K¥i¦³µ{¦¡½XÄݩʦ۰ʧ¹¦¨ªº²M³æ¨Ñ¿ï¨ú
¦p:
­Y¥¼³]©w¤Þ¥Î¶µ¥ØMICROSOFT HTML object libary®É
°õ¦æ®É
Dim MyIE As InternetExplorer³o¦æ´N·|³ø¿ù
¦]¬°³o®ÉEXCEL¨Ã¤£»{ÃÑInternetExplorer
³]©w¤Þ¥Î¶µ¥ØMICROSOFT HTML object libary«á¤~¯à¥¿½T«Å§i¦¹ª«¥ó
¨º»ò¦p¦óª¾¹D¸Óª«¥óÄݩʶµ¥Ø©O?
·í¿é¤JMyIE.®É´N¯à¥X²{¸Óª«¥ó©³¤U¥i¯à¨Ï¥ÎªºÄݩʲM³æ¤F
´N¸ò­ì¥»EXCELª«¥ó·í§Ú­Ì¥H¥¿½T¦æ¦¡¿é¤Jª«¥óµM«á´N·|¥X²{²M³æ¿ï¾Ü¤F
¦Ü©ó²Ä2ÂI,³o´N­n¹ïHTML»yªk¨Ó»{ÃѤF
TABLE¦bºô­¶¤¤¦ü¥G¬O¨S¦³¤@­ÓID¨Ñ§Ú­Ì¨Ó©ú½T«ü©w¨ì§Ú­Ì»Ý­nªºªí®æ(³o§Ú¤]¤£½T©w)
¦ý¬O¼gµ{¦¡¦³¤@­Ó¦@³qªº­ì«h´N¬O
±qÅܼƪº¸ê®Æ¤º®e¨Ó´M§ä³W«h
¦A¨Ì¾Ú³o¨Ç³W«h¹F¨ì¤ÀÃþ
¥H§Ú¼g¹Lªº¸gÅç
¦]¬°ªí®æ³q±`¦³¼ÐÃD¦C
¨º´N¥H³o¨Ç¤å¦r¨Ó°µ§PÂ_
¬Ý¬O§_¤w¸g¦b³oªí®æ¤W
¨Ò¦p:
¦³¤@ªí®æ
¤é´Á        ¼Æ¶q        ª÷ÃB
¬°¼ÐÃD¤å¦r
¨º»ò³oTABLEªºinnertextÄÝ©Ê­È´N¥i¥H¥Î¬O§_¬°Like "¤é´Á        ¼Æ¶q        ª÷ÃB*"
°µ¬°§PÂ_¨Ì¾Ú
Dim MyIE As InternetExplorer
with MyIE
      Set MyDoc = .Document
      With MyDoc
       For i = 0 To MyDoc.all.Length - 1
      If .all(i).tagName = "TABLE" Then
      MsgBox .all(i).innerText
          If .all(i).innerText Like "¤é´Á    ¼Æ¶q    ª÷ÃB*" Then
¥HÃþ¦ü¦¹ªk§Y¥i§PÂ_¥XTABLEªº¦ì¸m
¥H¤W¶È¥H­Ó¤H¹ïIE¾Þ§@ªº¤ß±o´£¥X
½Ð¼ô±x»yªkªº«e½ú¤£§[«ü¥¿
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

­Ó¤H¤ñ¸û²ßºDÂê©wID(getElementById)¨Ó¨ú­È[¦]¬°ID¬O°ß¤@ªº¡A¤£·|­«½Æ]¡A·íµMID¤£¬O¥²µMªº¡A¦pªG³]­pªÌ¥¼¥[¤J®É¡A¥u±o¨Ï¥ÎName or Tag¨Ó§ì¨ú¸ê®Æ¤F¡C

TOP

·PÁ¨â¦ì«e½úªº«üÂI

¤p§Ì¦b³oÃäÁÙ¦³°ÝÃD·Q½Ð±Ð¦U¦ì«e½ú,ÁٽЦU¦ì«e½ú¦hÀ°¦£,ÁÂÁÂ!

1. ÁöµMexcel·|¦Û°Ê¥X²{¥i¥H¿é¤JªºÄÝ©Ê,¦ý§ÚÁÙ¬O¤£ª¾¹D¦UÄÝ©Ê©Ò¥Nªíªº·N«ä¥H¤Î¥Îªk,©Ò¥H¤£ª¾¹DÃö©ó³o¨ÇÄÝ©Ê
     ªº¥Îªk¤Î·N¸q¸Ó¥h­þÃä¬d¸ß©O?­Y¬O¥hMSDN¬d¤S¸Ó¥Î¤°»òkey word©O?

2. ¦p¦PH¤j©Ò»¡,¥i¥H°w¹ïÅܼƪº¸ê®Æ¤º®e§ä¨ì³W«h,©Ò¥H§Ú¥Ø«e¤]¬O¥´ºâ³o»ò§@!
    ¦ý°ÝÃD¦b©ó¤£ª¾¹D¸ê®Æ¤º®e¨ì©³¬O¤°»ò ¡×¡@¡×"
    ¤ñ¤è»¡:°w¹ï¬Y¤@ºô­¶§ì¨ú¨ä¤¤ªºtable,¦ýºô­¶¤¤§ä¨ìªºtable¥i¯à¤£¥u¤@­Ó,¦Ó¥B´Nºâ¥u§ä¨ì¤@­Ó,¥i¯àtable
    ½s±Æªº¤è¦¡»P§Ú©Ò¬Ý¨ìªº¤]¤£¬Û¦P
     ©Ò¥H·Q»¡¤£ª¾¹D¦³¨S¦³¿ìªk§â§Ú§ì¨ú¨ìªº¸ê®ÆÅã¥Ü¥X¨Ó,¦p¦Pmsgboxªº®ÄªG

ÁÂÁ¤j®a!

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD