¦³ÃöEXCEL VBA §ì¨ú¤£¨ì§¹¾ãºô§}CSV°ÝÃD
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
Y¬O§Ú·Qcopy¤U¦Cºô§}¬Y¤Ñ¡B¬Y´X®aªº¸ê®Æ¡Ahttp://stocker.com.tw/
¥i§_½Ð¤j¤j¼·¤¾À°¦£¡A¦³ªþÀÉ
jak µoªí©ó 2014/3/6 11:38 
©êºp,¨S¦³ª`·N¨ì,¤[µ¥¤F.
¸Õ¸Õ¬Ý- <input type="text" name="StoNum" id="StoNum" style="width:100px" value="1101" onkeyup="findStoNum()">
- '<input type="text" name="datestart" id="datepicker" style="width:80px" value="2014-05-09" class="hasDatepicker">
- '<input type="submit" class="senddata" value="´£¥æ">
- Option Explicit
- Dim FormDLL As String, xDate As Date, Sh As Worksheet ', Msg As Boolean
- Sub Ie_Table()
- Dim URL As String, A As Object, i As Integer, E As Range
- Set_FormDLL
- URL = "http://stocker.com.tw/"
- xDate = Date - 1
- If Weekday(xDate, vbMonday) > 5 Then
- Do While Weekday(xDate, vbMonday) > 5
- xDate = xDate - 1
- Loop
- End If
- Set Sh = Sheets.Add 'µ²ªGÅã¥Ü¦b·s¼Wªº¤u§@ªí
- Sh.Name = Format(xDate, "yyyy-mm-dd") '©R¦W¬°¤é´Á
- With CreateObject("InternetExplorer.Application")
- .navigate URL
- .Visible = True
- For Each E In Sheets("¤U¸ü¥N¸¹¦W³æ").Range("A3", Sheets("¤U¸ü¥N¸¹¦W³æ").[A3].End(xlDown))
- Do While .Busy Or .ReadyState <> 4: Loop
- With .document.getElementsByTagName("input")
- .Item("StoNum").Value = E
- .Item("datestart").Value = Format(xDate, "yyyy-mm-dd")
- For i = 0 To .Length - 1
- If .Item(i).Type = "submit" Then .Item(i).Click
- Next
- End With
- Do While .Busy Or .ReadyState <> 4: Loop
- Set A = .document.getElementsByTagName("TABLE")
- Ep A(A.Length - 1).outerHTML
- Next
- .Quit
- End With
- Remove_FormDLL
- End Sub
- Sub Ep(S As String)
- Dim D As New DataObject, E As Shape
- '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
- With D
- .SetText S
- .PutInClipboard
- With Sh.UsedRange
- If .Rows.Count = 1 Then
- .Cells(1).Select
- Else
- .Rows(.Rows.Count).Cells(2).Select
- End If
- Sh.PasteSpecial Format:="Unicode ¤å¦r"
- With ActiveCell
- .Cells(2, 1) = "¤é´Á"
- .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Format(xDate, "mm/dd")
- End With
-
- End With
- End With
- End Sub
- Sub Set_FormDLL() '·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library
- On Error Resume Next
- FormDLL = "FM20.DLL"
- ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
- '"C:\windows\system32\"¬O2003ª©ªº¸ô®|,2003¥H¤Wª©¥»»Ýקï¸ô®|
- End Sub
- Sub Remove_FormDLL() '§R°£¤Þ¥Î Microsoft Forms 2.0 Object Library
- Dim D As Object
- For Each D In ThisWorkbook.VBProject.References
- If UCase(D.fullpath) Like "*" & FormDLL Then
- ThisWorkbook.VBProject.References.Remove D
- End If
- Next
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|