Forum Moderators: open

Message Too Old, No Replies

Trying to clean up a word doc to put into a database.

Need to ignore some lines

         

bateman_ap

11:52 pm on Feb 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, I have a word document with about 3000 items from a mailing I want to put in a daatabase. I have cleaned it up as much as I can and can import it into Excel no problem. However ther is a slight prob what is stopping me from being able to import it into my SQL database.

An example of the word doc is:

Bobs Blue Widget Store
1 Anytown, Anycity
Anycountry
+44 123 4567
Bob Smith
Managing Director
Sells Red widgets too
Widgets Type One

Steves World of Widgets
2 Sometown, SOmecity
Neverland
+44 456 7890
Steve Stone
CEO
Widgets Type Two

The problem is that 7 lines down on each address is up to 3 or 4 lines of rubblish I don't need. These make it impossible for me to turn this into my database as I can never work out where the last line (needed) is on each one.

What I really need to do is something like:
Keep lines 1, 2, 3, 4, 5, 6 and last and delete the rest for each block.

Anyone got any ideas how this can be sorted?

mattglet

1:17 am on Feb 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You just just query your Excel spreadsheet directly, and pull only the columns you need. You can connect to Excel just like any other database:

Conn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=c:\somepath\mySpreadsheet.xls;" & _
"DefaultDir=c:\somepath"

Check out connectionstrings.com for some more tips.