Automating Excel Imports

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.)
 
J

JE McGimpsey

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.
 
G

Greg Koppel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top