A
Alex
Hi,
I need to import a text file into a spreadsheet. I can do this manually by
doing File > Open > then select a text file. Then Excel goes through the
Text Import Wizard
I can automate this by recording a Macro in Excel. The macro looks like this
(Excell wrote that for me, I did not):
Sub Macro1()
Workbooks.OpenText Filename:="C:\DrillData\" + "MOR701.pck",
Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(12 _
, 1), Array(26, 1), Array(37, 1)), TrailingMinusNumbers:=True
End Sub
How can I change this macro to look at the content of cell Logs!A8 (Cell A8
in the tab called "Logs")
I guess it would look something like this:
Sub Macro1()
Workbooks.OpenText Filename:="C:\DrillData\" + _
content_cell (Logs!A8)&".pck", _
Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(12 _
, 1), Array(26, 1), Array(37, 1)), TrailingMinusNumbers:=True
End Sub
Thanks for your help
Alex.
I need to import a text file into a spreadsheet. I can do this manually by
doing File > Open > then select a text file. Then Excel goes through the
Text Import Wizard
I can automate this by recording a Macro in Excel. The macro looks like this
(Excell wrote that for me, I did not):
Sub Macro1()
Workbooks.OpenText Filename:="C:\DrillData\" + "MOR701.pck",
Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(12 _
, 1), Array(26, 1), Array(37, 1)), TrailingMinusNumbers:=True
End Sub
How can I change this macro to look at the content of cell Logs!A8 (Cell A8
in the tab called "Logs")
I guess it would look something like this:
Sub Macro1()
Workbooks.OpenText Filename:="C:\DrillData\" + _
content_cell (Logs!A8)&".pck", _
Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(12 _
, 1), Array(26, 1), Array(37, 1)), TrailingMinusNumbers:=True
End Sub
Thanks for your help
Alex.