krismcmillan
New Member
- Joined
- Aug 22, 2014
- Messages
- 17
Evening All
I'm trying to import an .rtf file (as per example below) into MS Access 2010, using VBA.
Owner Location Type Product Code Product Description/Desc 2 Pack Size Rotation No. H A Cases/ Units
E45 AA/09A/1 Pick 00271296 PU VALUE BINA RED ASSTD 0/ 0
E45 AA/09A/1 Pick 00319997 2B FASHIONJOGLEG BLU/GRY ASSTD 0/ 0
E45 AA/09A/1 Pick 00371296 PU VALUE BINA RED ASSTD 0/ 0
E45 AA/09A/1 Pick 00372379 PU VALUE BALLERINA BLACK ASSTD 0/ 0
E45 AA/09A/1 Pick 00471296 PU VALUE BINA RED ASSTD 0/ 0
I have managed to write the code below and it imports the first four columns into a access table, which is great.
Workbooks.OpenText FileName:="C:\Users\kmcmilla\Desktop\PFK.rtf", Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 9) _
, Array(4, 1), Array(9, 1), Array(22, 1), Array(31, 2), Array(53, 9), Array(84, 1)), _
TrailingMinusNumbers:=True
But I need to import the rest of the file, into a table. But not sure on how to adjust the Array statements to accommodate this.
Thanks
I'm trying to import an .rtf file (as per example below) into MS Access 2010, using VBA.
Owner Location Type Product Code Product Description/Desc 2 Pack Size Rotation No. H A Cases/ Units
E45 AA/09A/1 Pick 00271296 PU VALUE BINA RED ASSTD 0/ 0
E45 AA/09A/1 Pick 00319997 2B FASHIONJOGLEG BLU/GRY ASSTD 0/ 0
E45 AA/09A/1 Pick 00371296 PU VALUE BINA RED ASSTD 0/ 0
E45 AA/09A/1 Pick 00372379 PU VALUE BALLERINA BLACK ASSTD 0/ 0
E45 AA/09A/1 Pick 00471296 PU VALUE BINA RED ASSTD 0/ 0
I have managed to write the code below and it imports the first four columns into a access table, which is great.
Workbooks.OpenText FileName:="C:\Users\kmcmilla\Desktop\PFK.rtf", Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 9) _
, Array(4, 1), Array(9, 1), Array(22, 1), Array(31, 2), Array(53, 9), Array(84, 1)), _
TrailingMinusNumbers:=True
But I need to import the rest of the file, into a table. But not sure on how to adjust the Array statements to accommodate this.
Thanks