Macro Word To Excel

GirlG

New Member
Joined
Sep 12, 2018
Messages
3
I receive a file as a PDF and convert it into a Word file. From the Word document I have to extract information from and place into excel columns. Info looks like the following:

18-4879
Cashier: GirlG
Cashier Mother: MomG
Price: $64.00
Services Rendered: checking out
Name of Company: drug store
Regards to: payment
Products: soap, cream, bread

18-4879
Cashier: GirlG
Cashier Mother: MomG
Price: $64.00
Services Rendered: checking out
Name of Company: drug store
Regards to: payment
Products: soap, cream, bread

18-4879
Cashier: GirlG
Cashier Mother: MomG
Price: $64.00
Services Rendered: checking out
Name of Company: drug store
Regards to: payment
Products: soap, cream, bread

Please tell me this is possible. Maybe a macro?
The receipt number at the top is necessary, too.
The file is complete garbage. There are page numbers at the bottom of each page and a bunch of into at the beginning and end of the document. I really only need the info that I have listed above. Sometimes the Titles change... but I would just make more columns to include that information. What's most important is the receipt number, and of course, there isn't a title to distinguish it's a receipt number.

Hopefully, that all made sense.
Is there anything I can do? Should I work with it as a PDF, instead of turning it into a Word doc?

Thank you in advance,
Girl G
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Sometimes the Titles change...
What do you mean by that? It's not clear what you mean by 'Title'. Also, do any of your "page numbers at the bottom of each page" split the data for a given receipt?

Also, without knowing how your Wordbook, Worksheet and output range are to be identified, it's impossible to provide the code for that. Nevertheless, the following Word code should get you started:
Code:
Sub Demo()
With ActiveDocument.Range
  .Font.Hidden = True
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Font.Hidden = True
    .Replacement.Font.Hidden = False
    .Forward = True
    .Format = True
    .MatchWildcards = True
    .Wrap = wdFindContinue
    .Text = "^13[!^13]@: ([!^13]{1,})"
    .Replacement.Text = "^t\1"
    .Execute Replace:=wdReplaceAll
    .Text = "[0-9]{2}-[0-9]{4}"
    .Replacement.Text = "^p^&"
    .Execute Replace:=wdReplaceAll
  End With
  .Copy
  .PasteSpecial DataType:=wdPasteText
End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top