I am using excel vba with word object library to copy-paste a range in a word document.
wordSelection.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
I need to keep my Excel formating.
The problem reside in the fact that word add spaces between the lines of my copied table. The only way I've found to remove them is manually via word document "Line and Paragraph Spacing" on the dropdown "Remove Space Before Paragraph"
That's what I have :
Should be turned into this :
After searching, I found these parameters that should resolve my problem but It doen't work.
Selection.ParagraphFormat.Space1
Selection.ParagraphFormat.SpaceBefore = 0
Selection.ParagraphFormat.LineUnitAfter = 0
Selection.ParagraphFormat.CloseUp
Any help would be highly appreciated.
CodePudding user response:
You could use:
wordSelection.PasteAndFormat wdFormatOriginalFormatting