with: Erik Oosterwal
![]()
Custom Search
|
' Pop up a file selection window ' Make the default selection any ' file that fits "BWL*.XXL" varOpenFile = Application.GetOpenFilename("Data files (BWL*.XXL), BWL*.XXL") '----------------------------------------------------------------------------------------------------------------- ' GET NEW DATA ' Open the data file as a fixed width text file. The first column is read in as a date ' field, the other three columns are read in as "General", which means that numbers ' will be treated as numbers. Select the entire input data workbook, and copy it to the ' "Import Data" Sheet in this workbook. Then clear the clipboard of any information ' that was copied from the input data workbook, and close that workbook. The clipboard ' must be cleared otherwise the user gets a message asking if they want to keep the ' contents of the clipboard. '---------------------------------------------------------------------------------------------------------------- Workbooks.OpenText Filename:=varOpenFile, Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, ConsecutiveDelimiter:=True, _ Space:=True, FieldInfo:=Array(Array(1, _ 9), Array(2, 4), Array(3, 1), Array(4, 1), Array(5, 1))
*The underscores at the ends of some of the lines are continuation characters
that let you put a single command on multiple lines for readability.