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

½Ð°Ý¦p¦ó§ì¨újavascriptªº*.csvÀɮסH

¦^´_ 3# torrent



¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Sh As Worksheet, Rng As Range
  4.     Application.ScreenUpdating = False
  5.     Application.DisplayAlerts = False
  6.     Set Rng = Sheets("Sheet1").Range("A2")
  7.     On Error Resume Next
  8.     Set Sh = Sheets.Add
  9.     With Sh.QueryTables.Add("URL;http://prtr.epa.gov.tw/resultEMS.aspx?emsno=" & Rng & "&tab=Panel5", Sh.[A1])
  10.         .WebSelectionType = xlSpecifiedTables
  11.         .WebFormatting = xlWebFormattingNone
  12.         .WebTables = """GridView5"""
  13.         .WebPreFormattedTextToColumns = True
  14.         .WebConsecutiveDelimitersAsOne = True
  15.         .WebSingleBlockTextImport = False
  16.         .WebDisableDateRecognition = False
  17.         .WebDisableRedirections = False
  18.         .Refresh BackgroundQuery:=False
  19.     End With
  20.     Do While Rng <> ""
  21.         With Sh.QueryTables(1)
  22.             Rng.Offset(, 1).Range("A1:I1").Value = IIf(Err.Number = 0, Sh.QueryTables(1).ResultRange.Rows(2).Value, "")
  23.             Err.Clear
  24.             Set Rng = Rng.Offset(1)
  25.             .Connection = "URL;http://prtr.epa.gov.tw/resultEMS.aspx?emsno=" & Rng & "&tab=Panel5"
  26.             .Refresh BackgroundQuery:=False
  27.         End With
  28.     Loop
  29.     Sh.Delete
  30.     Application.DisplayAlerts = True
  31.     Application.ScreenUpdating = True
  32. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-1-5 06:52 ½s¿è

¦^´_ 5# torrent
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Sh As Worksheet, Rng As Range, Q As Variant
  4.     Application.ScreenUpdating = False
  5.     Set Rng = Sheets("Sheet1").Range("A2")  'ºÞ¨î½s¸¹
  6.     On Error GoTo ER
  7.     With Sheets("ºÞ¨î¤º®e")
  8.         Set Sh = Sheets(.Name)
  9.         .UsedRange = ""
  10.     End With
  11.     On Error Resume Next
  12.     With Sh.QueryTables.Add("URL;http://prtr.epa.gov.tw/resultEMS.aspx?emsno=" & Rng & "&tab=Panel5", Sh.[AA1])
  13.         .WebSelectionType = xlSpecifiedTables
  14.         .WebFormatting = xlWebFormattingNone
  15.         .WebTables = """GridView5"""
  16.         .WebPreFormattedTextToColumns = True
  17.         .WebConsecutiveDelimitersAsOne = True
  18.         .WebSingleBlockTextImport = False
  19.         .WebDisableDateRecognition = False
  20.         .WebDisableRedirections = False
  21.         .Refresh BackgroundQuery:=False
  22.     End With
  23.     Set Q = Sh.QueryTables(1)
  24.     Do While Rng <> ""
  25.         If Err = 0 And Application.Count(Q.ResultRange) > 0 Then
  26.             With Sh.Cells(Sh.Rows.Count, 2).End(xlUp)
  27.                 .Offset(1, -1) = Rng
  28.                 If .Row = 1 Then
  29.                     .Offset(, -1) = "ºÞ¨î½s¸¹"
  30.                     Q.ResultRange.Copy .Cells
  31.                 Else
  32.                     Q.ResultRange.Rows("2:" & Q.ResultRange.Rows.Count).Copy .Offset(1)
  33.                 End If
  34.             End With
  35.         End If
  36.         Err.Clear
  37.         Set Rng = Rng.Offset(1)
  38.         Q.Connection = "URL;http://prtr.epa.gov.tw/resultEMS.aspx?emsno=" & Rng & "&tab=Panel5"
  39.         Q.Refresh BackgroundQuery:=False
  40.     Loop
  41.     Q.ResultRange = ""
  42.     With Sh
  43.         .Columns.AutoFit
  44.         For Each Q In .Names
  45.            Q.Delete
  46.         Next
  47.         For Each Q In .QueryTables
  48.            Q.Delete
  49.         Next
  50.     End With   
  51.    Application.ScreenUpdating = True
  52.    Exit Sub
  53. ER:
  54.     If Err.Number = 9 Then
  55.         Sheets.Add.Name = "ºÞ¨î¤º®e"
  56.         Resume
  57.     End If
  58. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# torrent
³oºô­¶csv¤£¬OµLªk¤U¸ü¶Ü!,
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 10# torrent
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()  '¥þ³¡¸ê®Æ¶W¹L 65536µ§ 2003ª©¤£¾A¥Î
  3.     Dim Sh As Worksheet, wb As Workbook, i As Long
  4.     Set Sh = ActiveWorkbook.Sheets(1)
  5.     Sh.UsedRange = ""
  6.     i = 0
  7.     Do
  8.         Workbooks.OpenText Filename:="http://opendata.epa.gov.tw/ws/Data/EMS/?$orderby=RegistrationNo&$skip=" & i & "&$top=1000&format=csv" _
  9.             , Origin:=-535, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
  10.             xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
  11.             Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
  12.             Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _
  13.             Array(9, 1), Array(10, 1), Array(11, 1)), TrailingMinusNumbers:=True
  14.         With ActiveWorkbook.Sheets(1).UsedRange
  15.             If .Cells(1) = "" Then Exit Do
  16.             If i = 0 Then
  17.                 .Copy Sh.[a1]
  18.             Else
  19.                 .Offset(1).Copy Sh.[a1].End(xlDown).Offset(1)
  20.             End If
  21.             ActiveWorkbook.Close False
  22.         End With
  23.     i = i + 1000
  24.    Loop
  25.     ActiveWorkbook.Close False
  26. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 12# torrent
  1.            '.Resize(Q.ResultRange.Rows.Count, 1).Offset(2, -1).Value = Rng
  2.                     .Resize(Q.ResultRange.Rows.Count - 1, 1).Offset(1, -1).Value = Rng
  3.                     'Q.ResultRange.Rows.Count - 1 ->¤£¥]§tªíÀYªº¦C¼Æ
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ·O´d¨S¦³¼Ä¤H¡A´¼¼z¤£°_·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD