- ©«¤l
- 15
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 25
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- vba
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2015-3-8
- ³Ì«áµn¿ý
- 2024-11-18
|
[µo°Ý] EXCELE 2013 vba for windows 10 µLªk¥¿±`°õ¦æ
½Ð°Ý¦U¦ì¸ê²`«e½ú
¤p§Ìªñ¤é¨Ï¥Îwindows 10Àô¹Ò¤U°õ¦æ¦¹½s½X
µo²{«ö¤F¤§«á¡A¼Æ¾Ú¥þ§ì¤£¨ì¡C
¦ý¦bwindows 7Àô¹Ò¤U½T¥i¥H¡C
¤£ª¾¹D¬Oºô¯¸¼gªk¦³§ï¤F¡AÁÙ¬O¥»¨¨t²Î³y¦¨ªº
¦pªG¬O¨t²Î³y¦¨ªº¡A½Ð°Ý¦³¨S¦³§Oªº¤è¦¡¥i¥H¶i¦æ½Õ¾ã¡C¡C¡C- Private Sub CommandButton4_Click()
- Dim i As Integer, S As Integer, k As Integer, a As Object, ii, j, i1 As Integer, i2 As Integer, i3 As Integer
- '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
-
- 'ÃÒ¥æ©Ò«H¥Î¥æ©ö²Îp------------------------------------
-
- 'i3 = Mid(j, 1, 4)
- 'Sheets("¶q").Range("q1").Value = i3
- 'rul = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/genpage/Report" & "/A112" & j & "MS.php?select2=MS&chk_date=" & 104 & "/" & 3 & "/" & 13
- '"http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/genpage/Report201503/A11220150313MS.php?select2=MS&chk_date=104/03/13"
- 'http://www.tpex.org.tw/web/stock/margin_trading/margin_balance/margin_bal_print.php?l=zh-tw&d=104/04/01&s=0,asc,1
- 'j = Sheets("¶q").Range("a1").Value
- Application.DisplayStatusBar = True
- Application.ScreenUpdating = False
- Sheets("¶q").Range("Q1").Select
- ActiveCell.FormulaR1C1 = "=TEXT(MID(RC[-16],1,LEN(RC[-16])),""YYY"")"
-
- Sheets("¶q").Range("R1").Select
- ActiveCell.FormulaR1C1 = "=TEXT(MID(RC[-17],1,LEN(RC[-17])),""mm"")"
-
- Sheets("¶q").Range("S1").Select
- ActiveCell.FormulaR1C1 = "=TEXT(MID(RC[-18],1,LEN(RC[-18])),""dd"")"
-
- Sheets("¶q").Range("T1").Select
- ActiveCell.FormulaR1C1 = "=TEXT(MID(RC[-19],1,LEN(RC[-19])),""e"")"
- j = Sheets("¶q").Range("q1").Value
- j1 = Sheets("¶q").Range("r1").Value
- j2 = Sheets("¶q").Range("s1").Value
- j3 = Sheets("¶q").Range("t1").Value
- 'http://www.tpex.org.tw/web/stock/margin_trading/margin_balance/margin_bal_print.php?l=zh-tw&d=104/04/01&s=0,asc,1
- 'http://www.tpex.org.tw/web/stock/margin_trading/margin_balance/margin_bal_print.php?l=zh-tw&d=104/08/17&s=0,asc,1
- ii = "http://www.tpex.org.tw/web/stock/margin_trading/margin_balance/margin_bal_print.php?l=zh-tw&d=" & j3 & "/" & j1 & "/" & j2 & "&s=0,asc,1"
- Sheets("¶q").Range("o1").Value = i
- With CreateObject("InternetExplorer.Application")
- '.Visible = False
- '.Navigate "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/genpage/Report201503/A11220150313MS.php?select2=MS&chk_date=104/03/13"
- .Navigate ii
- '¤W±¬°ÃÒ¥æ©Ò¤T¤jªk¤H¶R½æª÷ÃB²Îpªí³sµ²
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Application.Wait (Now + TimeValue("00:00:10"))
- Ep15 .document.getElementsByTagName("table")(0).outerhtml
- 'Ãö³¬ºô¶
- .Quit
-
-
- End With
- Set a = CreateObject("InternetExplorer.Application")
- Set a = Nothing
- Application.StatusBar = False
- End Sub
- Sub Ep15(S As String)
- Dim d As New DataObject
- Dim shape As Excel.shape
- Application.DisplayStatusBar = True
- Application.ScreenUpdating = False
- '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 Sheets("¤W¥«Âd¤T¤jªk¤H").Select
- Sheets("¤W¥«Âd¤T¤jªk¤H").Range("P10:AI12").Clear
- Sheets("¤W¥«Âd¤T¤jªk¤H").Range("P10").Select
- Sheets("¤W¥«Âd¤T¤jªk¤H").PasteSpecial Format:="Unicode ¤å¦r"
- For Each shape In ActiveSheet.Shapes
- shape.Delete
- Next
- xRow = Sheets("¤W¥«Âd¤T¤jªk¤H").Range("P65536").End(xlUp).Row
- For i = 15 To xRow
- If Sheets("¤W¥«Âd¤T¤jªk¤H").Range("P" & i).Value = "¦Xp(±i)" Then
-
- Sheets("¶q").Range("M5").Value = Sheets("¤W¥«Âd¤T¤jªk¤H").Range("V" & i).Value
- Sheets("¶q").Range("N5").Value = Sheets("¤W¥«Âd¤T¤jªk¤H").Range("ad" & i).Value
- End If
- If Sheets("¤W¥«Âd¤T¤jªk¤H").Range("P" & i).Value = "¿Ä¸êª÷(¥a¤¸)" Then
- Sheets("¶q").Range("O5").Value = Sheets("¤W¥«Âd¤T¤jªk¤H").Range("V" & i).Value
- End If
- Next
- End With
-
- End With
- Set d = Nothing
-
-
- Application.StatusBar = False
- Sheets("¶q").Select
- Sheets("¶q").Range("A1").Select
- MsgBox "¤WÂd(«H)¤U¸ü§¹¦¨¡I"
- End Sub
½Æ»s¥N½X |
|