M
Mike Phelps
Hi
I have a legacy system that produces reports (Print Files) that we print on
an old dot matrix printer. Someone has asked me to email them these reports
so that they can view them on screen. I can open the Print files in Word but
the layout looks nothing like the printed reports because of print control
characters etc. I've looked on the web for a utility that will convert these
file automatically but can't find one, so I though I'd try to do it using
VBA. Unfortunately even though I have written a bit of code for Excel, this
is beyond me!
Any help would be appreciated.
The text file as opened in Word looks like this:
((P))header
ABC Company Ltd. ABC Company Ltd 2737051
Date : 11/09/2003 Schedule : Z3/
Some Street, Some Town Somewhere Company : 99
Page : ((P))
XXXXXXXXX - Daily Schedule Of Deliveries
(11/09/2003) Type BB Retail/Consumer
((H))8,2
Doc
Ref No
Wine
Cases Litres
Made Wine
Cases Litres
Cider/Perry
Cases Litres
Beer
Cases Litres
Low Alcohol
Cases Litres
Totals
Cases Litres
((H))end
----------------------------------------------------------------------------
-------------------------------------------------------
((P))end
((H))8
00022382
4 36.00
4 36.00
((H))end
((H))8,6
Totals
B/Fwd
C/Fwd
------- -----------
4 36.00
0 0.00
4 36.00
------- -----------
0 0.00
0 0.00
0 0.00
------- -----------
0 0.00
0 0.00
0 0.00
------- -----------
0 0.00
50 408.00
50 408.00
------- -----------
0 0.00
0 0.00
0 0.00
------ -----------
4 36.00
50 408.00
54 444.00
((H))end
((P))trailer
It should look more like this:
ABC Company Ltd. ABC Company Ltd 2737051
Date : 11/09/2003 Schedule : Z3/
Some Street, Some Town Somewhere Company : 99
Page : 1
XXXXXXXXX - Daily Schedule Of Deliveries
(11/09/2003) Type BB Retail/Consumer
Doc Wine Made Wine Cider/Perry
Beer Low Alcohol Totals
Ref No Cases Litres Cases Litres Cases Litres
Cases Litres Cases Litres Cases Litres
----------------------------------------------------------------------------
-------------------------------------------------------
00022382 4 36.00
4 36.00
------- ----------- ------- ----------- ------- -----------
------- ----------- ------- ----------- ------- -----------
Totals 4 36.00 0 0.00 0
0.00 0 0.00 0 0.00 4
36.00
B/Fwd 0 0.00 0 0.00 0
0.00 50 408.00 0 0.00 50
408.00
C/Fwd 4 36.00 0 0.00 0 0.00
50 408.00 0 0.00 54 444.00
I can cope with finding & replacing the printing characters like
((P))trailer and newpage but its getting the data into columns that is
stumping me.
Thanks
I have a legacy system that produces reports (Print Files) that we print on
an old dot matrix printer. Someone has asked me to email them these reports
so that they can view them on screen. I can open the Print files in Word but
the layout looks nothing like the printed reports because of print control
characters etc. I've looked on the web for a utility that will convert these
file automatically but can't find one, so I though I'd try to do it using
VBA. Unfortunately even though I have written a bit of code for Excel, this
is beyond me!
Any help would be appreciated.
The text file as opened in Word looks like this:
((P))header
ABC Company Ltd. ABC Company Ltd 2737051
Date : 11/09/2003 Schedule : Z3/
Some Street, Some Town Somewhere Company : 99
Page : ((P))
XXXXXXXXX - Daily Schedule Of Deliveries
(11/09/2003) Type BB Retail/Consumer
((H))8,2
Doc
Ref No
Wine
Cases Litres
Made Wine
Cases Litres
Cider/Perry
Cases Litres
Beer
Cases Litres
Low Alcohol
Cases Litres
Totals
Cases Litres
((H))end
----------------------------------------------------------------------------
-------------------------------------------------------
((P))end
((H))8
00022382
4 36.00
4 36.00
((H))end
((H))8,6
Totals
B/Fwd
C/Fwd
------- -----------
4 36.00
0 0.00
4 36.00
------- -----------
0 0.00
0 0.00
0 0.00
------- -----------
0 0.00
0 0.00
0 0.00
------- -----------
0 0.00
50 408.00
50 408.00
------- -----------
0 0.00
0 0.00
0 0.00
------ -----------
4 36.00
50 408.00
54 444.00
((H))end
((P))trailer
It should look more like this:
ABC Company Ltd. ABC Company Ltd 2737051
Date : 11/09/2003 Schedule : Z3/
Some Street, Some Town Somewhere Company : 99
Page : 1
XXXXXXXXX - Daily Schedule Of Deliveries
(11/09/2003) Type BB Retail/Consumer
Doc Wine Made Wine Cider/Perry
Beer Low Alcohol Totals
Ref No Cases Litres Cases Litres Cases Litres
Cases Litres Cases Litres Cases Litres
----------------------------------------------------------------------------
-------------------------------------------------------
00022382 4 36.00
4 36.00
------- ----------- ------- ----------- ------- -----------
------- ----------- ------- ----------- ------- -----------
Totals 4 36.00 0 0.00 0
0.00 0 0.00 0 0.00 4
36.00
B/Fwd 0 0.00 0 0.00 0
0.00 50 408.00 0 0.00 50
408.00
C/Fwd 4 36.00 0 0.00 0 0.00
50 408.00 0 0.00 54 444.00
I can cope with finding & replacing the printing characters like
((P))trailer and newpage but its getting the data into columns that is
stumping me.
Thanks