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

[µo°Ý] ¦p¦ó¶×¤JUTF-8 Ãþ«¬ªºÀÉ®×

[µo°Ý] ¦p¦ó¶×¤JUTF-8 Ãþ«¬ªºÀÉ®×

¥»©«³Ì«á¥Ñ bioleon69 ©ó 2017-5-16 14:36 ½s¿è

²Ä¤@ºØ¤èªk
¦ý¬O·|¶}¥X·sªºWORKBOOK
Workbooks.Open Filename:="https://smart.tdcc.com.tw/opendata/getOD.ashx?id=2-8", Format:=2


²Ä¤GºØ¤èªk
·|ÅܶýX
  1. Sub TESTCSV()
  2. Set book1 = ActiveSheet
  3. Set bookshow = book1.QueryTables _
  4.     .Add(Connection:="TEXT;https://smart.tdcc.com.tw/opendata/getOD.ashx?id=2-8", _
  5.         Destination:=book1.Range("A1"))
  6. With bookshow
  7.     .TextFileParseType = xlDelimited
  8.   .TextFileCommaDelimiter = True
  9.     .Refresh
  10. End With
  11. End Sub
½Æ»s¥N½X
¨âºØ¤èªk³£®t¤@ÂI
¦³¿ìªk¯à°÷¦¨¥\¶×¤J¤@­Ó¤u§@ªí¸Ì­±¤£¶Ã½X¶Ü

ÁÂÁÂ[/code]

1.JPG (125.75 KB)

1.JPG

VBA ±q0¶}©l
¥ý±q¾Ç·|¬ÝªºÀ´¶}©l
¥ý±q·|¦³°ò¥»­×§ï¯à¤O¶}©l
¤@¨B¤@¨B¾Ç²ß¤¤

¦^´_ 3# ML089

XD©_©Ç §Ú¦Û¤v´ú¸Õ¬OOKªº~
ÁÙ¬OÁÂÁ¤j¤j¤À¨É³o­Ó¥t¥~¤@ºØ¤èªk
ÁÙ¯S§O¤W¦â XDÆg
§Ú¨Ó¬ã¨s¤@¤U³o­Ó¤èªk~
ÁÂÁÂ^^
VBA ±q0¶}©l
¥ý±q¾Ç·|¬ÝªºÀ´¶}©l
¥ý±q·|¦³°ò¥»­×§ï¯à¤O¶}©l
¤@¨B¤@¨B¾Ç²ß¤¤

TOP

¦^´_ 2# bioleon69

§Ú´ú¸Õ«áÁÙ¬O¶Ã½X

¥i¥H°Ñ¦Ò
https://www.mtmd.tw/mtmd_7236.htm

¥Î¿ý»s¥¨¶°¤è¦¡
'
' Macro3 Macro
'

'
    ActiveWorkbook.Worksheets.Add
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;https://smart.tdcc.com.tw/opendata/getOD.ashx?id=2-8", Destination:= _
        Range("$A$1"))
        .Name = "getOD.ashx?id=2-8"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
       .TextFilePlatform = 65001
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
End Sub
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ bioleon69 ©ó 2017-5-16 22:51 ½s¿è

°ÝÃD¤w¸Ñ¨M~
¦³»Ý­n¥i°Ñ¦Ò,¥H¤U¬°¸Ñ¨M¤èªk
  1. Sub ´¡¤JUTF8«á§R°£()
  2.     Dim sh As Worksheet
  3.     ActiveSheet.Select
  4.     tabname = "TEST"
  5.     For Each sh In Worksheets
  6.     If sh.Name = tabname Then Exit Sub
  7.     Next

  8.     ControlFile = ActiveWorkbook.Name
  9.     Workbooks.Open Filename:="https://smart.tdcc.com.tw/opendata/getOD.ashx?id=2-8"
  10.     ActiveSheet.Name = tabname
  11.     Sheets(tabname).Copy After:=Workbooks(ControlFile).Sheets(1)
  12.     Application.DisplayAlerts = False
  13.     Workbooks("getod.ashx").Close
  14.     Application.DisplayAlerts = True
  15. End Sub
½Æ»s¥N½X
VBA ±q0¶}©l
¥ý±q¾Ç·|¬ÝªºÀ´¶}©l
¥ý±q·|¦³°ò¥»­×§ï¯à¤O¶}©l
¤@¨B¤@¨B¾Ç²ß¤¤

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD