- ©«¤l
- 96
- ¥DÃD
- 18
- ºëµØ
- 0
- ¿n¤À
- 125
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-3-23
- ³Ì«áµn¿ý
- 2022-8-2
|
¥»©«³Ì«á¥Ñ smart3135 ©ó 2014-5-23 11:13 ½s¿è
¦^´_ 67# GBKEE
ª©¥D±z¦n¡A¸g¹L¤µ¤Ñ¦¤W¤£Â_¨Ï¥Î2003ª©´ú¸Õ¡A²×©ó°µ¥X§Ú·Qnªº¿é¥X¤å¦rÀɵ²ªG¡A¤£¹LÁÙ¬O¦³¨Ç°ÝÃD·|µo¥Í¡A¥ýªþ¤Wµ{¦¡½X»PªþÀÉ
¶°«O¤á-·s.zip (128.04 KB)
³o¸Ì¬O§¹¾ãªºµ{¦¡½X- Option Explicit
- Dim IE As Object, A As Integer
- Sub IE_Application()
- Dim I As Integer
- Set IE = CreateObject("InternetExplorer.Application")
- With IE
- .Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
- ' .Visible = True '¤£Åã¥Üie
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- 'Ū¨ú¶°«O¤áªÑÅv¤À´²ªí¬d¸ßªº¸ê®Æ¤é´ÁÁ`Ó¼Æ
- A = .document.getelementsByTagName("select")("SCA_DATE").Length - 1
- End With
- End Sub
- Sub ¶°«O()
- Dim Rng As Range, E As Range, x As Variant, T As Date, xPath As String, xFile As String
- Dim Ea As Variant, ii As Integer, F As String, H As String, J As Integer
- T = Time
- Application.DisplayStatusBar = True
- '½Ð±N¤WÂdªºªÑ²¼¥N¸¹,¦b Sheets(3).Range("A1")©¹¤UKey¤W,°j°é¨Ì³o¸ÌªºªÑ²¼¥N¸¹¶×¤J
- Set Rng = ThisWorkbook.Sheets(3).Range("A:A")
- If Application.Count(Rng) = 0 Then MsgBox "¨S¦³ªÑ²¼¥N¸¹": Exit Sub
- Set Rng = Rng.SpecialCells(xlCellTypeConstants)
- xPath = "E:\°]³ø¸ê®Æ"
- IE_Application '
- Application.StatusBar = " "
- For Each E In Rng
- With Sheets(1)
- .Activate
- .Cells.Clear '¤U¸ü¸ê®Æ¸m©ó¦¹¤u§@ªí,ÅÜ´«ªÑ²¼®É:²MªÅ
- End With
- With IE
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(5).outerHTML
- End With
-
- For x = 0 To A
- With IE
- .document.getelementsByTagName("select")("SCA_DATE")(x).Selected = True
- '³o¸Ìªº¸ê®Æ¤é´Á »Ý¥Î Select ¥¦¬O¦³[¦~«×¤ë¥÷¤é´Á]ªº
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(6).outerHTML
- End With
- With IE
- .document.getelementsByTagName("select")("SCA_DATE")(x).Selected = True
- '³o¸Ìªº¸ê®Æ¤é´Á »Ý¥Î Select ¥¦¬O¦³[¦~«×¤ë¥÷¤é´Á]ªº
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(7).outerHTML
- End With
- Next x
- With Sheets(1)
- F = .Range("a3")
- J = Len(F)
- If J >= 19 Then
- H = Mid(F, 1, 3)
- Else
- H = Mid(F, 1, 2)
- End If
- .Range("a1") = E & "-" & H & " " & "¶°«O¤áªÑÅv¤À´²ªí"
- .Rows("2:4").Delete
- End With
- xFile = xPath & "\" & E & "\SHD.txt"
- MkDir_Sub xFile
- Maketxt xFile, Sheets(1).UsedRange, E.Value
- '***·Q½Ð°Ý±zCode As StringªºCode¬O«ç»ò±a¥XӪѽs¸¹ªº ****
- 'xFile(²Ä¤@Ó¤Þ¼Æ), Sheets(1).Range("A1").CurrentRegion(²Ä¤GÓ¤Þ¼Æ),E.Value(²Ä¤TÓ¤Þ¼Æ)
- ii = ii + 1
- Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤W¥«¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ"
- Next E
- IE.Quit
- Application.StatusBar = Application.Text(Time - T, ["MM¤ÀSS¬í"]) & " ¦@¶×¤J¤W¥«¤ë¦¨¥æ " & ii & " ¤å¦rÀÉ, Ū¨ú§¹²¦ !! "
- MsgBox "¶×¤J ¤å¦rÀÉ" & ii & " ¶O®É " & Application.Text(Time - T, ["MM¤ÀSS¬í"])
- ' ThisWorkbook.Save
- End Sub
- Sub Ep(S As String)
- Dim D As New DataObject, E As Shape, FormDLL As String, Rng As Range
- 'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
- '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
- On Error GoTo ER
- With D
- .SetText S
- .PutInClipboard
- With Sheets(1)
- .Range("a" & .Rows.Count).End(xlUp).Select
- Set Rng = Selection
- If Rng = 15 Then
- Rng.Offset(3).Select
- Else
- Rng.Offset(2).Select
- End If
- .PasteSpecial Format:="Unicode ¤å¦r"
- ' If Selection = "" Then Selection.Offset(1).Select
- ' Set Rng = Selection
- ' Rng.Sort Key1:=Rng.Range("B2"), Order1:=xlDescending, Header:=xlYes ', _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
- :=xlStroke, DataOption1:=xlSortNorma
- End With
- End With
- Exit Sub
- ER:
- FormDLL = "FM20.DLL"
- ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\" & FormDLL
- Resume
- End Sub
- Sub Maketxt(xF As String, Q As Range, Code As String) '±N¶×¤J¸ê®Æ¦s¤J«ü©wªºtxt
- '***·Q½Ð°Ý±zCode As StringªºCode¬O«ç»ò±a¥XӪѽs¸¹ªº ****
- ' xF(±µ¦¬ªº¤Þ¼Æ¦WºÙ) As String(¦r¦ê«¬ºA), Q As Range(Rangeª«¥ó«¬ºA), Code As String(¦r¦ê«¬ºA)
- Dim fs As Object, E As Range, C As Variant
- Set fs = CreateObject("Scripting.FileSystemObject")
- Set fs = fs.CreateTextFile(xF, True) '³Ð¨£¤@ÓÀÉ®×,¦pÀɮצs¦b¥iÂл\±¼
- For Each E In Q.Rows
- C = Application.Transpose(Application.Transpose(E.Value))
- C = Join(C, vbTab)
- fs.WriteLine C
- Next
- fs.Close
- End Sub
- Sub MkDir_Sub(S As String)
- Dim AR, I As Integer, xPath As String
- If Dir(S) = "" Then
- AR = Split(S, "\")
- xPath = AR(0)
- For I = 1 To UBound(AR) - 1
- xPath = xPath & "\" & AR(I)
- If Dir(xPath, vbDirectory) = "" Then MkDir xPath
- Next
- End If
- End Sub
½Æ»s¥N½X ¦]¬°§Únªº¤å¦rÀÉ°£¤FӪѥN¸¹©M¦WºÙ¤§¥~¡AÁÙ¦³¤é´Á¤]n¤@¨Ö¼g¤J¡A©Ò¥H§Ú´N¦Û¤v¥[¤F¥H¤U³o¨ÇªF¦è- With IE
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(5).outerHTML
- End With
-
- For x = 0 To A
- With IE
- .document.getelementsByTagName("select")("SCA_DATE")(x).Selected = True
- '³o¸Ìªº¸ê®Æ¤é´Á »Ý¥Î Select ¥¦¬O¦³[¦~«×¤ë¥÷¤é´Á]ªº
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(6).outerHTML
- End With
- With IE
- .document.getelementsByTagName("select")("SCA_DATE")(x).Selected = True
- '³o¸Ìªº¸ê®Æ¤é´Á »Ý¥Î Select ¥¦¬O¦³[¦~«×¤ë¥÷¤é´Á]ªº
- .document.getElementById("StockNo").Value = E
- .document.getelementsByTagName("INPUT")("sub").Click '«ö¤U¬d¸ß
- '³o¸Ìªº¬d¸ß¬O<INPUT TYPE="submit" VALUE="¬d¸ß" name="sub">
- Do While .Busy Or .readyState <> 4: Loop
- Ep .document.getelementsByTagName("TABLE")(7).outerHTML
- End With
½Æ»s¥N½X 1.º¥ý²Ä¤@¬q¬O¬°¤FnÂ^¨ú("TABLE")(5)¤~¯à¶×¤JӪѦWºÙ¡A©Ò¥H§Ú¥[¤F³o¨Ç»yªk¡A¥Ñ©óӪѦWºÙ¥u»ÝnÂ^¨ú¤@¦¸
©Ò¥H±N³o¬q»yªk¼g¦bx°j°é¤§¥~¡A¦ý¤£ª¾¹D³o¼Ëªº»yªk¥¿¤£¥¿½T
2.¦]¬°nÂ^¨úªº¤é´Á¬O¦b("TABLE")(6)¡A©Ò¥H±N³o¬q¤]¼g¤J¡A´N¥u¬O½Æ»s("TABLE")(7)ªº§ï¦¨6¦Ó¤w¡A¤]¤£½T©w³o¼Ë¼g¨ì©³¥¿¤£¥¿½T
3.¥H¤Wµ{¦¡½X¦b2003¨Ï¥ÎF8³v¦æ°õ¦æ®É¬O¥i¥H¥¿±`ªº¡A¦ý¨Ï¥ÎF5³sÄò°õ¦æ®É¦³®É·|¥X¿ù¡A¤£µM´N¬O("TABLE")(5)©M("TABLE")(6)·|¦³¸ê®Æ«ÂЩΪ̺|§ì
¥H("TABLE")(6)§ì¨ìªº¤é´Á¨Ó»¡¡A·|§ì¨ì¨âÓ¤@¼Ëªº¤é´Á(¤é´Á¿ù»~)¡A¦ý¸ê®Æ¤º®eªº("TABLE")(7)«o¬O¤£¦Pªº(¤º®e¥¿½T)¡A¤]´N¬O¤é´Á©M¸ê®Æ¤º®e¹ï¤£¤W
¤£ª¾¹D¬O¤£©M§Úªº»yªk¦³°ÝÃD
¥t¥~¥ý«e¦V±z´£¹L¡A¥Î2007°õ¦æ¤Wzµ{¦¡½X®É·|¥X¿ù¡A¥X¿ù¥N½X¬°"424"¡A¥X¿ù°T®§¬°"¦¹³B»Ýnª«¥ó"¡A§Ú¦³ÂI»¡©ú¶i¥h¬Ý¡A¦ý¯uªº¬Ý¤£¤ÓÀ´
§Ú±N»¡©ú¤º®e¦s¦¨PDF¤@°_©ñ¦bªþ¥ó¤¤¡A¥i¥Hªº¸Ü¦A³Â·Ð±z¬Ý¬Ý¬O¤£¬O¥i¥H§ä¥X¬°¤°»ò³oÓµ{¦¡½X¨Sªk¦b2007°õ¦æªºì¦]¡A¦A¦¸·PÁ±z¡I |
|