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

[µo°Ý] ½Ð±Ð~¦p¦ó§ìºô­¶ ªº¤å¦rÀÉ¦Ü excel ¤º

[µo°Ý] ½Ð±Ð~¦p¦ó§ìºô­¶ ªº¤å¦rÀÉ¦Ü excel ¤º

' ¤§«e ¬O§ì CºÐ ªº¤å¦rÀÉ
' ²{¦b ±ý§ì ºô­¶ ªº¤å¦rÀÉ
' ¸Ó ¦p¦ó ³B²z ¥i¥H½Ð °ª¤â À°¦£  ·PÁÂ
'1¤§«e§ì CºÐ


SS = "C:\123\123.txt"

If Dir(SS) <> "" Then
    Open SS For Input As #1
        Line Input #1, DataLine
    Close #1
    Dataarray = Split(DataLine, ",")

         Sht1.Range("U4") = Dataarray(0)  '®É¶¡
         Sht1.Range("V4") = Dataarray(1)  '¼Æ¦r
         Sht1.Range("W4") = Dataarray(2)  '¼Æ¦r
         Sht1.Range("X4") = Dataarray(3)  '¼Æ¦r
         Sht1.Range("Y4") = Dataarray(4)  '¼Æ¦r
         Sht1.Range("Z4") = Dataarray(5)  '¼Æ¦r
         Sht1.Range("AA4") = Dataarray(6) '¼Æ¦r

'2¤§«á§ì ºô­¶

' ¸g¥Ñ ¿ý»s ¦p¤U ¤º®e¦p¤U (®É¶¡+ 6µ§¼Æ¦r) 19:01:01,11,22,33,44,55,66
' ¦n¤ñ http://192.168.1.1/123/123.txt (ºô§}°²ªº)


SS = Sht1.[P34]

    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://" & SS & ".txt", Destination:=Sht1.Range("$U$4"))
        .CommandType = 0
        .Name = "123"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = False
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = False
        .RefreshPeriod = 0
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False

' ¿ý»s «á ¨C°õ¦æ¤@¦¸¡A³£·|"¥X²{" ³o¸Ì¤w¸g¦³¸ê®Æ¡A§A­n¨ú¥N³oµ§¸ê®Æ¶Ü? (½T©w) (¨ú®ø)
        ¦p ¹Ï
' ¸ê®Æ­åªR¡A±N ³æ¤@Àx¦s®æ¤ºªº¸ê®Æ¡A¨Ì³r¸¹ ©î¸Ñ


    Range("U4").Select
    Selection.TextToColumns Destination:=Range("U4"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
        Array(7, 1)), TrailingMinusNumbers:=True
        
    End With

123456.jpg

·PÁÂ
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD