Automating Excel Imports

  • Thread starter Thread starter JohnMM
  • Start date Start date
J

JohnMM

Is there a way to automate the import of a flat, ASCII
file into an Excel spreadsheet? (This file has fixed-
length fields.)
 
Start with recording a macro importing the file (Tools/Macro/Record new
macro).

If you need help modifying it, post back in the .programming group.
 
Here is some code that you can modify for your circumstance

Sub CMM_Test()
'
' CMM_Test Macro
' Macro recorded 12/13/99 by Greg
'

'
ChDir "\\Bd-1555\c-drive\APOGEE\Results"
Workbooks.OpenText Filename:= _
"\\Bd-1555\c-drive\APOGEE\Results\1213991_lapped.txt",
Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False,
Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2,
1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1),
Array(8, 1), Array(9, 1))
End Sub

HTH, Greg
 
Back
Top