I have a problem where I insert 1000's of rtf files into one consolidated word document. I define the format of the consolidated file and start inserting all the document. The problem is when I insert the rtf file document which has data embedded into a
word tables aligns left (after inserting). How to get the alignment as is from the input file? I do not want to use copy/paste preserve method as it is very slow for what I am doing.
I have attached sample rtf file I use as well as a sample macro that I use to consolidate. The sample macro is not the actual code I use. I use ranges and many lines of code to perform other things. But, the provided macro should give you an understanding
of what I am trying to do.
Place the sample file.rtf in a folder. Run the below macro. Now, compare the sample file.rtf with the consolidated i.e. the inserted word document then you will see the inserted word document has its table aligned left when you highlight the table.
Please help.
https://drive.google.com/file/d/0B925g5AXvujTN3I1elVEZ09KSUE/view?usp=sharing
Sub Macro5()
'
' Macro5 Macro
'
'
Selection.PageSetup.Orientation = wdOrientLandscape
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.5)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(11)
.PageHeight = InchesToPoints(8.5)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.Font.Name = "Times"
Selection.Font.Size = 10
Selection.InsertFile FileName:="sample file.rtf", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.HomeKey Unit:=wdStory
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdStory
End Sub