写一个将南方工程之星的原始dat文件导入到excel的函数。方便大家使用。
Sub AddDat()
'/石陆软件屋 http://www.cnng.net
Dim fname As String, MaxRow As Long
MaxRow = ActiveSheet.UsedRange.Rows.Count
If MaxRow > 1 Then MaxRow = MaxRow + 1
fname = Application.GetOpenFilename("Datfile (*.Dat), *.Dat,All files (*.*),*.*", 0, "选择打开文件", , False)
If LCase(fname) = "false" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & fname, Destination:=Range("A" & MaxRow))
.TextFileCommaDelimiter = True
.Refresh BackgroundQuery:=False
End With
End Sub
引用通告地址 (0):
http://www.cnng.net/blog/trackback.asp?tbID=90
http://www.cnng.net/blog/trackback.asp?tbID=90&CP=GBK
http://www.cnng.net/blog/trackback.asp?tbID=90
http://www.cnng.net/blog/trackback.asp?tbID=90&CP=GBK