Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Reformatting text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter L - 18 Feb 2008 14:53 GMT
I receive a report in Word and need to export to an Access database.  The
problem is the record format isn't in a delimited format.  Each record in
Word has the following format:

fied1 text (tab) field2 text(paragraph)
field3 text (tab) field4 text(paragraph)
field5(paragraph)
paragraph
number
paragraph
Next Record

I would like to create a macro or something so the format for each record is
something like: text, text, text, text, number so I can save as txt and
import into Access.
Jean-Guy Marcil - 18 Feb 2008 15:10 GMT
> I receive a report in Word and need to export to an Access database.  The
> problem is the record format isn't in a delimited format.  Each record in
[quoted text clipped - 11 lines]
> something like: text, text, text, text, number so I can save as txt and
> import into Access.

The macro could be;

Sub ReformatFields()

Dim rgeDoc As Range

Set rgeDoc = ActiveDocument.Range

With rgeDoc.Find
   .Text = "(*)^t(*)^13(*)^t(*)^13(*)^13(*^13)"
   .Replacement.Text = "\1,\2,\3,\4,\5,\6"
   .Wrap = wdFindStop
   .MatchWildcards = True
   .Execute Replace:=wdReplaceAll
End With

Application.Browser.Target = wdBrowsePage

End Sub

But you could use the .Text and .Repalcement.Text parameters (from the macro
above) directly in the Find/Replace dialog box, making sure to have checked
the Wild Cards option (After clicking on the "More..." button.)
Peter L - 18 Feb 2008 16:49 GMT
Thank you, I'm going to give this a try.

> > I receive a report in Word and need to export to an Access database.  The
> > problem is the record format isn't in a delimited format.  Each record in
[quoted text clipped - 35 lines]
> above) directly in the Find/Replace dialog box, making sure to have checked
> the Wild Cards option (After clicking on the "More..." button.)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.