How can I indent a table that was copied from Excel into Microsoft Word? What might be wrong with my present code to cause an error?
I tried using rngPara.Indent. My present code scans an Excel range for "Cases," pulls them out, and produces a Word document for each Case. Pastes table5 Case "table5" in the current case.
A part from my current code for copy-pasting Excel table:
Dim wdRngPL As Object 'Word.Range
Set wdRngPL = .Range.Characters.Last
Case "table5"
ThisWorkbook.Sheets("Pricelist").Range("B31:D681").Copy
With wdRngPL
Set rngPara = .Paragraphs.Last.Range
rngPara.Style = "Attachment"
rngPara.PasteExcelTable False, False, False
'.Tables(.Tables.Count).AutoFitBehavior wdAutoFitWindow
.Font.Hidden = 0
rngPara.Indent
Set rngPara = Nothing
End With
I want to simulate manual work. If I remove rngPara.Indent then my process goes like this. The table is getting pasted to Word from Excel. I have to go to the Word document select my table and hit Increase Indent one time.