p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Word VBA (http://p2p.wrox.com/word-vba-231/)
-   -   Word text setting issue (http://p2p.wrox.com/word-vba/99227-word-text-setting-issue.html)

SMI// October 19th, 2016 01:02 PM

Word text setting issue
 
ADMIN, I MISTAKENLY POST THE SAME QUESTION IN EXCEL VBA AND I APOLOGIZE FOR THIS. PLZ DELETE THE SAME POST FROM EXCEL VBA SECTION. THANKS


Hi there,
Please see txt file copied at the end of this message and look for following certain elements after header info. This report when imported in Word is showing 170 pages of similar text, so I have copied just a small part of it to make my point clear. Not sure how to add a text file as attachment in this thread for now, so copying text directly here.

You will notice that for each cancelled invoice or invoice line data, there is some header data like customer name, order number, order date, customer number, salesperson and currency. This data is followed by details from that specific order.

I want to move all this header info to the detailed tabulated info for each record using macro. In other words I would like to first move headings (which are customer name, order number, order date, customer number, salesperson and currency) for each record next to Category column and their respective data in the below lines for each Line number. You will see Line number on extreme left being the first column of tabulated data.

Please advise if this could be handled using VBA. I have few years of experience using VBA in Excel but I am new to Word VBA and therefore your help would be much appreciated.

Regards,
SMI



Quote:



Customer Name: ENGRO ELENGY TERMINAL (PVT.) LIMITED. Customer Number: 2712622
Order Number: 3000001 Salesperson: No Sales Credit
Order Date: 16-NOV-15 Currency: PKR

------------------------- Cancel -------------------------
Line Item Date Quantity Unit Amount Reason By Category
------------ ----------------------- --------- ---------- ------- ------------ --------------- ------- ----------
1.1 Discharge control - Vessel - VSL - T 23-NOV-15 1 VSL 125,000. No reason provided SAEED_A ORDER
10.1 Discharge control - Vessel - VSL - T 24-NOV-15 1 VSL 189,855. No reason provided ALEXEY_ ORDER
2.1 Sampling - Vessel - VSL - Trade - OG 23-NOV-15 1 VSL 125,000. No reason provided SAEED_A ORDER
8.1 Discharge control - Vessel - VSL - T 24-NOV-15 1 VSL 1,800. No reason provided ALEXEY_ ORDER
9.1 Discharge control - Vessel - VSL - T 24-NOV-15 1 VSL 601. No reason provided ALEXEY_ ORDER
---------- -------------
Order 3000001 Totals: 5 442,256.2






Customer Name: METRON MIDDLE EAST FZE. Customer Number: 2713577
Order Number: 3000002 Salesperson: No Sales Credit
Order Date: 17-NOV-15 Currency: USD

------------------------- Cancel -------------------------
Line Item Date Quantity Unit Amount Reason By Category
------------ ----------------------- --------- ---------- ------- ------------ --------------- ------- ----------
1.1 Loading control - Vessel - MT - Trad 26-NOV-15 1000.298 MT 1,863. No reason provided MOHAMMA ORDER
---------- -------------
Order 3000002 Totals: 1,000.298 1,863.0






Customer Name: ALCOTRA S.A. GENEVA Customer Number: 2712148
Order Number: 3000004 Salesperson: No Sales Credit
Order Date: 17-NOV-15 Currency: USD

------------------------- Cancel -------------------------
Line Item Date Quantity Unit Amount Reason By Category
------------ ----------------------- --------- ---------- ------- ------------ --------------- ------- ----------
1.1 Loading control - Vessel - MT - Trad 19-NOV-15 699.986 MT 1,189. No reason provided SAEED_A ORDER
2.1 Loading control - Vessel - MT - Trad 19-NOV-15 1788.164 MT 3,352. No reason provided SAEED_A ORDER
3.1 Analysis - Package A - Ea - LS - Fie 19-NOV-15 2 Ea 700. No reason provided SAEED_A ORDER




Customer Name: ALCOTRA S.A. GENEVA Customer Number: 2712148
Order Number: 3000004
Order Date: 17-NOV-15

------------------------- Cancel -------------------------
Line Item Date Quantity Unit Amount Reason By Category
------------ ----------------------- --------- ---------- ------- ------------ --------------- ------- ----------
---------- -------------
Order 3000004 Totals: 2,490.15 5,242.7






Customer Name: ALCOTRA S.A. GENEVA Customer Number: 2712148
Order Number: 3000005 Salesperson: No Sales Credit
Order Date: 17-NOV-15 Currency: USD

------------------------- Cancel -------------------------
Line Item Date Quantity Unit Amount Reason By Category
------------ ----------------------- --------- ---------- ------- ------------ --------------- ------- ----------
1.1 Loading control - Vessel - MT - Trad 26-NOV-15 1995.52 MT 3,741. No reason provided MOHAMMA ORDER
2.1 Analysis - Package A - Ea - LS - Fie 26-NOV-15 1 Ea 350. No reason provided MOHAMMA ORDER
---------- -------------
Order 3000005 Totals: 1,996.52 4,091.6





All times are GMT -4. The time now is 07:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.