How to convert Word table to Excel without losing formatting?

How to convert Word table to Excel without losing formatting?

I am trying to convert a word document to Excel.

The table in the document is too wide for Excel and I need to reduce its width.

I am using the following code: Sub ExportWord(). Application.ScreenUpdating = False Dim objDoc As Document. Set objDoc = Documents.Open(ActiveDocument.Path & "" & ActiveDocument.Name)
Dim objTable As Object. Set objTable = objDoc.Tables(1) For Each objCell In objTable.Cells objCell.Select With Selection. .MoveEnd Unit:=wdStory, Extend:=wdExtend .MoveEnd Unit:=wdDrawingObject, Extend:=wdExtend .MoveEnd Unit:=wdChartObject, Extend:=wdExtend .MoveEnd Unit:=wdDrawingObjects, Extend:=wdExtend .MoveEnd Unit:=wdColumn, Extend:=wdExtend .MoveEnd Unit:=wdPageBreak, Extend:=wdExtend End With. Next objCell. objDoc.SaveAs Filename:="C:Testfile.xlsx"
objDoc.Close objDoc.Quit Set objDoc = Nothing. Set objTable = Nothing. Application.ScreenUpdating = True End Sub. The problem is that this code looses all formatting of the cells (eg font, colour etc.) How can I change the code to convert the table without loosing formatting? Change this line: To this: With objCell.Range When you use Selection, the code will try to access an object that doesn't exist.

Related Answers

How can I open a PDF file in Excel for free?

How to Convert PDF to Excel for Free. Convert PDF to Exce...

How to convert Word file to Excel without losing formatting?

When I create a Word table, it's a single c...

Is there a free program to convert PDF to Excel?

I've seen a few programs that are supposed to be able to c...