I am trying to create a macro to import a data file which is in .PRN format. I was able create macro to open the file, But i dont have an option to open a diiferent file each time.
I need some help to create a file popup menu to select the data file. The file has to be imported to a different sheet.
This is my recorded Macro code to do the function:
Sub Import()
'
' '
Sheets("Raw Data").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;G:PRN'ssp01020402.prn" _
, Destination:=Range("A1"))
.Name = "sp01020402_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.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)
.Refresh BackgroundQuery:=False
End With
End Sub
Please help me create a popup menu to Selct a particular data file
I need some help to create a file popup menu to select the data file. The file has to be imported to a different sheet.
This is my recorded Macro code to do the function:
Sub Import()
'
' '
Sheets("Raw Data").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;G:PRN'ssp01020402.prn" _
, Destination:=Range("A1"))
.Name = "sp01020402_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.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)
.Refresh BackgroundQuery:=False
End With
End Sub
Please help me create a popup menu to Selct a particular data file