Word to Excel

hjgrassi

New Member
Joined
Feb 1, 2025
Messages
3
Office Version
  1. 2010
Platform
  1. Windows
I have a Word document that I need to convert to an Excel sheet. The document has the following structure: bold text RGB 0, 0, 160 that should go in column 1 of the Excel sheet, bold text RGB 0, 128, 64 that would go in column 2 of Excel, normal text RGB 0, 0, 0, 0 that would go in column 3 of Excel, bold text RGB 128, 0, 0, 0 that would go in column 4 of Excel, normal text RGB 0, 0, 0, 0 that would go in column 5 of Excel, the latter may be absent. Then the process starts again, moving on to the next row of Excel with the bold text RGB 0,0,160 and so on until the end of the document.
I appreciate your help in advance.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Welcome to the MrExcel board!

I am not sure this is something I can help with but is there any chance that you could make up a small sample Word document with the required formatting and the corresponding Excel workbook with the required results manually filled in from the Word document and upload them both to DropBox/OneDrive/Google Drive etc and provide publicly shared links to both here?

That way whoever might be able to help would have something relevant to test with and also the expected result to compare as they test. :)
 
Upvote 0
That is not a document structure; all it describes is some character formatting. What else is in the document (e.g. other text, tabs, paragraph breaks, etc.)?
 
Last edited:
Upvote 0
Welcome to the forum,

This possibly sounds as though your using/referring to a table. As suggest by Peter if you can provide an example it will help find a solution. Also I agree with Macropod that your only describing formatting.
 
Upvote 0
Welcome to the MrExcel board!

I am not sure this is something I can help with but is there any chance that you could make up a small sample Word document with the required formatting and the corresponding Excel workbook with the required results manually filled in from the Word document and upload them both to DropBox/OneDrive/Google Drive etc and provide publicly shared links to both here?

That way whoever might be able to help would have something relevant to test with and also the expected result to compare as they test. :)
Attached link to site.rar My office version is 2010
 
Upvote 0
Try the following Word macro:
VBA Code:
Sub ExportToExcel()
'Note: This code requires an VBA refernce to Excel to be set, via Tools|Refernces in the VBA IDE
Application.ScreenUpdating = False
Dim objUndo As UndoRecord: Set objUndo = Application.UndoRecord
With ActiveDocument
  objUndo.StartCustomRecord ("Export")
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "^l"
      .Replacement.Text = "^p"
      .Wrap = wdFindContinue
      .Forward = True
      .Format = False
      .Execute Replace:=wdReplaceAll
      .Text = ""
      .Replacement.Text = "^t^&"
      .Font.Bold = True
      .Font.Color = 4227072
      .Execute Replace:=wdReplaceAll
      .Font.Color = wdColorDarkRed
      .Execute Replace:=wdReplaceAll
      .ClearFormatting
      .Font.Color = wdColorBlack
      .Execute Replace:=wdReplaceAll
      .ClearFormatting
      .Text = "^t."
      .Replacement.Text = "^t"
      .Execute Replace:=wdReplaceAll
      .Text = "^t "
      .Execute Replace:=wdReplaceAll
    End With
    .ConvertToTable Separator:=wdSeparateByTabs, AutoFitBehavior:=wdAutoFitFixed
    .Tables(1).Columns(7).Delete
    .Tables(1).Columns(2).Delete
    .Tables(1).Range.Copy
    objUndo.EndCustomRecord
  End With
  .Undo
  .Range(0, 0).Select
End With
Dim xlApp As New Excel.Application, xlWkBk As Excel.Workbook
With xlApp
  'Add a workbook
  Set xlWkBk = .Workbooks.Add
  With xlWkBk.Sheets(1)
  'Paste the data
    .Paste
    .UsedRange.WrapText = False
    .Columns.AutoFit
    .Rows.AutoFit
    .Range("A1").Select
  End With
  .CutCopyMode = False
  .Visible = True
End With
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,272
Messages
6,189,984
Members
453,587
Latest member
miriammth4

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