【发布时间】:2015-08-08 08:47:23
【问题描述】:
我创建了一个按钮,可将特定 .csv 文件导入我的 Excel 工作表。但是,我想指定单击按钮时打开哪个文件。所以如果按下按钮:Excel打开资源管理器,用户可以指定打开哪个文件。
With ActiveSheet.QueryTables.Add(Connection:="TEXT;Path\20150728.csv", _
Destination:=Range("$A$1"))
.Name = "Tasks-Job--1g2MZtgw-Feike_15min_data-20150728"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 932
.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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
我尝试实现以下代码:
Call Shell("explorer.exe" & " " & "Path", vbNormalFocus)
但我没能让它正常工作。有什么建议吗?
【问题讨论】: