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

[µo°Ý] VBA»yªk°ÝÃD

[µo°Ý] VBA»yªk°ÝÃD

¤j®a¦n¡A§Ú¬O­è­èÆp¬ãVBA»yªkªº·s¤â...

¥Ñ©ó¤âÀY¦³¤u§@¥²¶·±Nexcelªº¸ê®Æ¨Ì§Ç¶ñ¤Jºô­¶¤¤ªºªÅ®æ

aaa.JPG

EXCEL¦³AÄæ»PBÄd¨âÄ檺¸ê®Æ

·Q­n¨Ì·Ó A1 (²Ä¤@µ§¸ê®Æ)¶ñ¤J ²Ä1¸¹³æ¸¹
                  B1(²Ä¤@µ§¸ê®Æªº±¾¸¹½X) ¶ñ¤J²Ä1¸¹ªº±¾¸¹½X

¥Ø«e¹J¨ìªº°ÝÃD¬O ¥H¤U¦Cªºµ{¦¡½X¨Ó¶]Àɮתº¸Ü

Private Sub UserForm_Activate()
Dim myIE As InternetExplorer
Dim url$, sDoc As Object
Dim x As integer

Set myIE = WebBrowser1
With myIE
    url = "¤½¥q¤ººô"
    .Navigate url
    Do While .Busy Or .ReadyState <> READYSTATE_COMPLETE
    DoEvents
    Loop
    With .Document
        Set x = Row(1, 0)
        For Each sDoc In .all.tags("input")
            If sDoc.Name = "item" Then sDoc.Value = Range("A1").Offset(x, 0)
            If sDoc.Name = "mailNumber" Then sDoc.Value = Range("B1").Offset(x - 1, 0)
            x = x + 1
        Next
        For Each sDoc In .all.tags("input")
            If InStr(sDoc.Value, "µn¤J") > 0 Then
                sDoc.Click
            End If
        Next
    End With
End With
End Sub

¥Ñ©ó§Ú¦³100µ§¥H¤Wªº¸ê®Æ¡A¦ý¬O¥L·|¦bAÄ椤¸õ¸¹¡A¹ïÀ³ªºBÄæ¤]·|¦³»~®t1Äæ(¨Ò¦pAÄæ²Ä¤@µ§¸ê®Æ·|¹ï¨ìBÄæ²Ä¤Gµ§¸ê®Æ¡A
¬Gµ{¦¡½X§Ë¦¨Range("B1").Offset(x - 1, 0))

°õ¦æ§¹µ{¦¡¤§«á¡A³Ì¦h¥u¶]¨ì27µ§...¤£ª¾¹D¸Ó«ç»ò¼Ë­×§ï³o­Ó¿ù»~¡A½Ð¤j®aÀ°¦£¡AÁÂÁÂT.T

§A¥ý½T»{¬Ý¬Ý³o­Ó°j°é,  ¬O§_¦³±½§¹¾ã­Óºô­¶ªº input

        For Each sDoc In .all.tags("input")
            'If sDoc.Name = "item" Then sDoc.Value = Range("A1").Offset(x, 0)
            'If sDoc.Name = "mailNumber" Then sDoc.Value = Range("B1").Offset(x - 1, 0)
            x = x + 1
            debug.print sDoc.Name
        Next

TOP

diolin¤j§A¦n

¦Ò¼{¨ì©Ò¦³ªºinput §Ú±N©Ò¦³input­È³£¶ñ¤W¤F
Private Sub UserForm_Activate()
Dim myIE As InternetExplorer
Dim url$, sDoc As Object
Dim x As Integer

Set myIE = WebBrowser1
With myIE
    url = "¤½¥q¤ººô"
    .Navigate url
    Do While .Busy Or .ReadyState <> READYSTATE_COMPLETE
    DoEvents
    Loop
    With .Document
        For Each sDoc In .all.tags("input")
            If sDoc.Name = "Sys_BatchNumber" Then sDoc.Value = [M1]
            If sDoc.Name = "Sys_mailNumber1" Then sDoc.Value = [N1]
            If sDoc.Name = "Sys_mailNumber2" Then sDoc.Value = [O1]
            If sDoc.Name = "ChkPasse" Then sDoc.Value = 1
            If sDoc.Name = "item" Then sDoc.Value = Range("A1").Offset(x, 0)
            If sDoc.Name = "mailNumber" Then sDoc.Value = Range("B1").Offset(x - 1, 0)
            If sDoc.Name = "CarNo" Then sDoc.Value = 1
            x = x + 1
        Next
        For Each sDoc In .all.tags("input")
            If InStr(sDoc.Value, "µn¤J") > 0 Then
                sDoc.Click
            End If
        Next
    End With
End With
End Sub

¦ý¬O¨ÌµMÁÙ¬O¥u¦³¸õ¨ì27µ§

¦Ó¥BÄæ¦ì¶Ã¸õªº°ÝÃDÁÙ¦b(¹³¬Oºô­¶²Ä¤@­ÓªÅ®æ©~µM¬O²Ä¤Cµ§¸ê®Æ(A7))

¤£ª¾¹D¸Ó«ç»ò¿ì...

TOP

¦^´_ 3# ts00690106
§âÊI页¤Wªº·½码贴¥X来¡C­n¬Ý¨ìÊI页¤¤ªº±±¥ó¥¬§½¤~¦n¦³针对©Êªº§ä¨ì问题¡C
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

        ÀR«ä¦Û¦b : §g¤l¬°¥Ø¼Ð¡A¤p¤H¬°¥Øªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD