+ Reply to Thread
Results 1 to 3 of 3

Word macro to process string into a report

  1. #1
    Registered User
    Join Date
    03-15-2019
    Location
    Pretoria, South Africa
    MS-Off Ver
    MS Office 2016
    Posts
    6

    Word macro to process string into a report

    Good day all,

    I need some assistance to process a string to be in an organised report to copy to an excel spreadsheet.

    Here is an example of the string and I have attached the layout of the report:

    **Start**SAECPFR Natal SCM Production MTN SIBONGILEN 24/06/19 13:39:44 Page 1 101122 FRESH ORDER LIST Facility Warehouse. . . .: 2 03 Delivery Date. . . . . . .: 26/06/19 Buyer Sequence - Detail Restrict To Vendor Number: Restrict To Store Number .: Restrict to Country . . .: Buyer ID : B04 BALAN CHETTY Vendor. .: 0102966 VEGEWORTH CC Vendor Order Number : ____________ Item. . .: 2394175 2394175 VEGEWORTH SALAD POTATO Size : 300G Pack : 8 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11592 HILLCREST KWIKSPAR FR:12/6/17 41064 2 2 __________ 076 ========= ========= Total for 2394175 2394175 VEGEWORTH SALAD POTATO : 2 2 BOH: On Ord Qty: 2 Item. . .: 2394291 2394291 V/WORTH SAL T/T POT&COLE Size : 300GR Pack : 8 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11592 HILLCREST KWIKSPAR FR:12/6/17 41064 1 1 __________ 076 ========= ========= Total for 2394291 2394291 V/WORTH SAL T/T POT&COLE : 1 1 BOH: On Ord Qty: 1 Item. . .: 2394993 2394993 VEGEWORTH SALAD COLESLAW 300G Size : 300G Pack : 8 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11592 HILLCREST KWIKSPAR FR:12/6/17 41064 2 2 __________ 076 ========= ========= Total for 2394993 2394993 VEGEWORTH SALAD COLESLAW 300G : 2 2 BOH: On Ord Qty: 2 Item. . .: 2455496 2455496 VEGWORTH SALAD BEETROOT Size : P/KG Pack : 2 Pick Slot : 000000 Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 10948 FOURWAYS KWIKSPAR / TOPS 41146 1 1 __________ 085 ========= ========= Total for 2455496 2455496 VEGWORTH SALAD BEETROOT : 1 1 BOH: On Ord Qty: 1 Item. . .: 2456158 2456158 VEGWORTH SALAD CHAKALAKA 2'S Size : 2.5KG Pack : 2 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11627 BLUFF S/S & TOPS FR:01.02.18 41066 1 1 __________ 094 ========= ========= Total for 2456158 2456158 VEGWORTH SALAD CHAKALAKA 2'S : 1 1 BOH: On Ord Qty: 1 Item. . .: 2456270 2456270 VEGEWORTH SALAD CREAMY POTATO Size : 2.5KG Pack : 2 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11627 BLUFF S/S & TOPS FR:01.02.18 41066 1 1 __________ 094 ========= ========= Total for 2456270 2456270 VEGEWORTH SALAD CREAMY POTATO : 1 1 BOH: 1 On Ord Qty: 1 Item. . .: 2456458 2456458 V/WORTH SALAD BABY POTATO Size : 2.5KG Pack : 2 Pick Slot : FL00A Store Store Delivery Name Ord No Orig O/Qty Accept Qty Actual Qty Loadpoint 11627 BLUFF S/S & TOPS FR:01.02.18 41066 1 1 __________ 094 ========= ========= Total for 2456458 2456458 V/WORTH SALAD BABY POTATO : 1 1 BOH: On Ord Qty: 1**End**

  2. #2
    Registered User
    Join Date
    03-15-2019
    Location
    Pretoria, South Africa
    MS-Off Ver
    MS Office 2016
    Posts
    6

    Re: Word macro to process string into a report

    See attached

    Attachment 629756

  3. #3
    Registered User
    Join Date
    03-15-2019
    Location
    Pretoria, South Africa
    MS-Off Ver
    MS Office 2016
    Posts
    6

    Re: Word macro to process string into a report

    Solution to my own problem

    Private Function LineBefore(strFind As String, strReplace As String)


    With Selection.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = strFind
    .Replacement.Text = vbNewLine & strReplace
    .Execute Replace:=wdReplaceAll

    End With




    End Function
    Private Function LineAfter(strFind As String, strReplace As String)


    With Selection.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = strFind
    .Replacement.Text = strReplace & vbNewLine
    .Execute Replace:=wdReplaceAll

    End With




    End Function


    Sub Check()

    Dim docEach As Document



    Call LineBefore("SAECPFR", "SAECPFR")
    Call LineBefore("101122 FRESH ORDER LIST", "101122 FRESH ORDER LIST")
    Call LineAfter("Vendor Order Number : ____________ ", "Vendor Order Number :!! ")
    Call LineBefore("Buyer Sequence", "Buyer Sequence")
    Call LineBefore("Buyer ID ", "Buyer ID ")
    Call LineBefore("Store Store Delivery Name", "Store Store Delivery Name")

    Call LineAfter("Loadpoint ", "Loadpoint ")
    Call LineBefore("Item", " Item")
    Call LineBefore("========= ========= ", " ========= ========= ")
    Call LineAfter("========= ========= ", " ========= ========= ")
    Call LineAfter("__________ ^#^#^#", "__________ 001")





    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Word VBA Macro for comparing Word Reports - Process indicator
    By coeurdange57 in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2017, 03:19 AM
  2. Create Macro/ Process to Send from Excel to Word Template
    By phiko73 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-02-2016, 12:55 PM
  3. Automation Process of Schedule Report Output and Report Check Score Card !
    By ozman86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2014, 10:28 AM
  4. Hi, I would like to automate a process for processing an exception report
    By paynegaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2013, 07:12 PM
  5. [SOLVED] How to automate a monotonous & time-consuming process in Word by way of creating a macro??
    By Rob8489 in forum Word Programming / VBA / Macros
    Replies: 10
    Last Post: 05-09-2012, 04:01 AM
  6. Making a Macro to create a report in word
    By draglin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-16-2008, 05:17 PM
  7. WORD-DELIMITED string vba macro for excel/word
    By jackal2k6 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2005, 12:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1