Best phone camera 2017
I'm new at this so bear with me please.
I am trying to convert a table in a Word .doc into a .csv to import into mysql.
When I copy the contents of a table cell where there are multiple paragraphs within the cell the result in Excel is multiple rows, one for each paragraph.
Can someone give me a hint on what I should be doing so that each cell is contained within o single row?
I tried Shift | Enter in Word to separate the paragraphs but that didnt work. I want to maintain the paragraph structure in the database.
You have woken me up now because I cannot understand why you need you go via Excel t
o do this.
In Word you possibly need to use a Shift + Enter to produce a carriage return that Excel will recognise?
A bit more info would help.
One way around it is to convert those paragraph marks & linebreaks to unique
characters, then copy|paste and then convert them back to linefeeds.
I like this technique (inside a copy of the word file):
Select your table.
Edit|replace|Special (show More if required)
Find what: (paragraph mark under Special button)
replace with: $$$$$ (if $$$$$ doesn't appear in the table)
Same thing with Manual Line break (from under Special).
Now copy the table into Excel.
Replace what: $$$$$
Replace with: hit and hold the alt and type 0010 from the number pad--not above
It may look like you haven't done anything, but if you did it right, you
replaced $$$$$ with alt-enter.
(this is copied from):
Dim wdDoc As Object
Dim wdFileName As Variant
Dim TableNo As Integer 'table number in Word
Dim iRow As Long 'row index in Excel
Dim iCol As Integer 'column index in Excel
wdFileName = Application.GetOpenFilename("Word files (*.doc),*.doc", , _
"Browse for file containing table to be imported")
If wdFileName = False Then Exit Sub '(user cancelled import file browser)
Set wdDoc = GetObject(wdFileName) 'open Word file
TableNo = wdDoc.tables.Count
If TableNo = 0 Then
MsgBox "This document contains no tables", _
vbExclamation, "Import Word Table"
ElseIf TableNo > 1 Then
TableNo = InputBox("This Word document contains " & TableNo & " tables." & vbCrLf & _
"Enter table number of table to import", "Import Word Table", "1")
'copy cell contents from Word table cells to Excel cells
For iRow = 1 To .Rows.Count
For iCol = 1 To .Columns.Count
Cells(iRow, iCol) = WorksheetFunction.Clean(.cell(iRow, iCol).Range.Text)
Set wdDoc = Nothing
To use this, open a blank Excel workbook. ALT + F11 to open the Visual Basic Editor. Insert|Module and paste in the code above. Close the VBE. Go to a blank worksheet, Tools|Macros|Macro, click ImportWordTable and click the Run button.
VoG - I attempted to make the transition in Word and found the same problem when converting table to text. Tried Shift + Enter and it didnt resolve. Thought I would try Copy + Paste into Excel to see if it made a difference. Result = no differnece.
Silverous - I'll give the suggestions a try and get back to you.
Thanks for the replies.
VoG - I'll give this one a go as well.
Bingo, that was simple. Wish I had asked the question on Wednesday
This thread is now locked and can not be replied to.