码迷,mamicode.com
首页 > 其他好文 > 详细

VBA 以文本格式打开DSV

时间:2014-05-14 22:32:10      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   class   code   java   

bubuko.com,布布扣
Public Function GetDataFromDSV(fpath As String) As Collection
    Dim AllTextFormat(255) As Integer
    Dim i As Long
    For i = 0 To 255
       AllTextFormat(i) = xlTextFormat
    Next i
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Application.Workbooks.Add
    With ActiveWorkbook.Sheets(1).QueryTables.Add(Connection:= _
        "TEXT;" & fpath, Destination:=Range("$A$1"))
        .Name = "test_1"
        .PreserveFormatting = True
        .TextFilePlatform = 936 简体中文 932 JIS 65001 UTF-8
        .TextFileCommaDelimiter = True
        .TextFileColumnDataTypes = AllTextFormat
        .Refresh BackgroundQuery:=False
    End With
    
    With ActiveWorkbook.Sheets(1)
    执行逻辑代码
    End With
    
    ActiveWorkbook.Close False
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
End Function
bubuko.com,布布扣

 

VBA 以文本格式打开DSV,布布扣,bubuko.com

VBA 以文本格式打开DSV

标签:des   style   blog   class   code   java   

原文地址:http://www.cnblogs.com/yuzhengdong/p/3728667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!