Hi there,
I have ole objects embedded in a word file.
To be able to edit the ole objects (word tables) I need to double click on them and another instance of word opens. This is a lot of work.
Thus, I would like to convert them to word object in one macro run that I can edit them easily.
The following macro works only if you right click on each object and do object convert to Microsoft Word Macro-Enabled Document before you run the macro.
When you run the script it is only converting the one you have applied the conversion.
However, I would like to run a macro ones and all objects are converted.
Macro:
Code:
Sub Convert_Ole_to_Word()
Dim DocA As Document
Dim DocB As Document
Dim ilsh As InlineShape
Dim rngB As Range
Dim rngA As Range
Set DocA = ActiveDocument
For Each ilsh In DocA.InlineShapes
If InStr(1, ilsh.OLEFormat.ProgID, "Word.Document", vbTextCompare) = 1 Then
Set DocB = ActiveDocument.InlineShapes(1).OLEFormat.Object
Set rngA = ilsh.Range
If DocB.Tables.Count = 1 Then
Set rngB = DocB.Tables(1).Range
rngB.Copy
ilsh.Delete
rngA.Paste
End If
End If
Next ilsh
End Sub
Much appreciated if you could help and modify the macro?
Many thanks.
Regards,
T.