Attribute VB_Name = "ConvertTablesToOLEs"
Sub ConvertTablesToOLE()

'

' ConvertTablesToOLE Macro

' Macro by Kevin Murphy
' kevin.murphy@baselinesinc.com
' http://www.baselinesinc.com
'
'
' This macro should be run on a document before importing it into DOORS. 
' It converts each table to an OLE object, and thus when you export it to
' DOORS, the Tables will be OLE objects and NOT be converted to DOORS tables.

 

'Move to top of document

 

Selection.GoTo What:=wdGoToPage, which:=wdGoToFirst

 

 

'Get count of tables

Dim tCount As Integer

Dim i As Integer

tCount = ActiveDocument.Tables.Count

 

i = 1

 

While i <= tCount

 

 

Selection.GoTo What:=wdGoToTable, which:=wdGoToNext 'go to first cell of next table

Selection.MoveUp Count:=1

Selection.EndKey

Selection.TypeParagraph

Selection.MoveDown Count:=1

Selection.Tables(1).Range.Select

Selection.Cut

Selection.MoveUp Count:=1

 

    

    Selection.InlineShapes.AddOLEObject ClassType:="Word.Document.8", FileName _
        :="", LinkToFile:=False, DisplayAsIcon:=False

    ActiveWindow.Selection.Paste

    ActiveWindow.Close

 

 

 

i = i + 1

tCount = ActiveDocument.Tables.Count 'We now have one less table, so tCount gets updated

 

Wend

 

End Sub



