¥»©«³Ì«á¥Ñ smart3135 ©ó 2017-11-11 10:08 ½s¿è
·Q½Ð±Ð¤@¤U¦U¦ì«e½ú¡A¦]¬°§Ú¤½¥q¦³¨Ç¤u§@¬O»Ýn«½Æ°õ¦æ
§âEXCEL¤º®e¼g¨ì°O¨Æ¥»¸Ì¡A³o¨â¤Ñ°µ¤F«Ü¦h¥\½Ò
¤jP¤W«e¥b¬qµ{¦¡½X¤w¸g¼gªº®t¤£¦h¤F
³Ñ¤U´N¬O«á¥b¬q¼g¤J°O¨Æ¥»(ÁÙ¨S¶}©lµÛ¤â)
¦ý¬O²{¦b¹J¨ì¤@ÓÃøÃD¡A´N¬O«e¥b¬qªºµ{¦¡½X
¦b§ì¨ú¤£¨ì¬Û¹ïÀ³ªººô¶®É·|¥X²{¿ù»~µøµ¡
§Úª¾¹D¥i¥H¥Îon error resume next¨Ó©¿²¤¿ù»~
¦ý«o·|¥d¦b±µ¤U¨ÓªºDo While .Busy Or .ReadyState <> 4: DoEvents: Loop
§Î¦¨µL°j°é¡A¦Ó¦pªG¨Ï¥Î¥t¤@ºØon error goto XX
¦b§Ú¦Û¤v³]©wªº°j°é¤¤¡A²Ä¤@¦¸¬O¥i¥H¸õ¨ì·Qnªºµ{§Ç¦ì¸m
¦ý°õ¦æ²Ä¤G¦¸´N·|¥X¿ù¡A¤£ª¾¹D¬°¤°»ò¡A¹ê¬O¦b§ä¤£¨ì¤èªk¤F¡A©Ò¥H¤~¨Ó½Ð±Ð¦U¦ì«e½ú
³Ì²z·Qªº±¡ªp´N¬O§ì¤£¨ìºô¶®É³s¿ù»~µøµ¡³£¤£n¸õ¥X
ª½±µ¸õ¨ì§Ú³]©w°j°éªºNEXT¡A³Â·Ð¦U¦ì«e½ú«üÂI¤@¤U¡AÁÂÁ¡C
¤£ª¾¹D¬°¤°»òÀ£ÁYÀɪºÀɮץᤣ¤W¨Ó
¥u¯à©ñ¤Wµ{¦¡½X
- Option Explicit
- Sub Ex1()
- On Error GoTo AR
- Dim A, B, C, D, E, F, G, H, I, J, K As String, R, rng As Range
- Dim URL, URL1, URL2, URL3, URL4, URL5, URL6, URL7, URL8, URL9, URL10 As String
- J = InputBox("½Ð¿é¤Jºô¶¸¹½X")
- H = InputBox("½Ð¿é¤J¤u³æ¸¹½X")
- With Sheets(2)
- Set rng = .Range("A1", .Range("A65535").End(xlUp))
- End With
- 'URL1 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\NXTL_Feeder SetupRepIndex_T.html"
- 'URL2 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\NXTL_Part PlacementRepIndex_T.html"
- 'URL3 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPF_Feeder SetupRepIndex_T.html"
- 'URL4 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPF_Part PlacementRepIndex_T.html"
- 'URL5 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\NXTL_Feeder SetupRepIndex_B.html"
- 'URL6 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\NXTL_Part PlacementRepIndex_B.html"
- 'URL7 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPF_Feeder SetupRepIndex_B.html"
- 'URL8 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPF_Part PlacementRepIndex_B.html"
- 'URL9 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPFB_Feeder SetupRepIndex_B.html"
- 'URL10 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & "\XPFB_Part PlacementRepIndex_B.html"
-
- With CreateObject("InternetExplorer.Application")
- For Each URL In rng
- URL1 = "C:\FujiFlexa\Client\Report\Jobdata\job00" & J & URL
- .Visible = False
- ' On Error Resume Next
- On Error GoTo AR
-
- ' On Error Resume Next '§ä¤£¨ìºô¶ÁÙµLªk¸Ñ¨M
- ' On Error GoTo 0
- .Navigate URL1
-
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- .execwb 17, 2 '¿ï¨ú ºô¶¤º®e
- .execwb 12, 2 '½Æ»s ºô¶¤º®e
-
- Sheets(1).Activate
- With ActiveSheet '«ü©w¤u§@ªí
- .Cells.Clear '²M²z ¤u§@ªí
- .[a1].Select
- .PasteSpecial Format:="Unicode ¤å¦r", Link:=False, DisplayAsIcon:= _
- False, NoHTMLFormatting:=True
-
- .[a1].Select
- End With
- .Quit
-
-
- If InStr([A2], "Feeder") Then
- A = "_" + Mid([A7], 9, 3) + "A" + Right([A9], 2) 'NXTA_T
- ' MsgBox A
- B = Left([A9], Len([A9]) - 2) '¥h±¼§À¤Úªº_T
-
- If InStr(Mid(B, 13, 3), "_") Then
- C = Mid(B, 13, 3) '¦pªG¦³_´N¬OLA©ÎLB
- Else
- C = Mid(B, 13, 4) '¦pªG¨S¦³´N¬OLAB©ÎLBB
- End If
- If InStr(Mid([A9], 23, 1), "_") Then
- D = Right(B, Len(B) - 22) '§ìµ{¦¡ª©¥»
- Else
- D = Right(B, Len(B) - 21) '§ìµ{¦¡ª©¥»
- End If
- I = "_" + Mid([A11], 10, 6)
- Else
- A = "_" + Mid([A7], 9, 3) + "A" + Right([A8], 2) + "S" 'NXTA_TS
- ' MsgBox A
- B = Left([A8], Len([A8]) - 2) '¥h±¼§À¤Úªº_T
- If InStr(Mid(B, 13, 3), "_") Then
- C = Mid(B, 13, 3) '¦pªG¦³_´N¬OLA©ÎLB
- Else
- C = Mid(B, 13, 4) '¦pªG¨S¦³´N¬OLAB©ÎLBB
- End If
- If InStr(Mid([A8], 23, 1), "_") Then
- D = Right(B, Len(B) - 22) '§ìµ{¦¡ª©¥»
- Else
- D = Right(B, Len(B) - 21) '§ìµ{¦¡ª©¥»
- End If
- I = "_" + Mid([A10], 10, 6)
- End If
- ' MsgBox B
- ' MsgBox C
- ' MsgBox D
-
-
- E = C + H + D + I + A
- MsgBox E
- AR:
- Next
- End With
-
- End Sub
½Æ»s¥N½X |