Import macro with user connection selection
Posted on 2011-10-25
I have the following macro below that imports data from a usb stick.
As you can see it gets the data from E:\1_attlog.dat.
The problem I have is that on my users computers there usb stick they plug in may be another drive other than E drive like on my computer.
What I was thinking is that on sheet "FP Reader" F6 they have to enter the drive letter that there memory stick use's. Then the code below choses the drive letter from F6.
Is this possible???
With ActiveSheet.QueryTables.Add(Connection:= _
.Name = "1_attlog_2"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
Selection.ColumnWidth = 6