[英]How do I copy Data from a excel in to word and keep its formatting
I have been trying to copy text from excel in to word, and retain the bold formatting on the text, but not the cell. 我一直在尝试将文本从excel中复制到word中,并保留文本的粗体格式,但不保留单元格的格式。 When I try manually copy and paste over a cell the text is copied but not the cell itself. 当我尝试手动复制并粘贴到单元格上时,将复制文本,而不是单元格本身。 When I try repeat this using vb (as shown below) the cell is also copied over 当我尝试使用vb重复此操作(如下所示)时,单元格也会复制到
With wrdDoc
.Content.Font.Name = "Times New Roman"
.Content.Font.Size = 11
.Content.InsertParagraphAfter
.Content.InsertParagraphAfter
With Worksheets("Sheet1")
Cells(1, 1).Select
Cells(1, 1).Copy
End With
.Content.InsertAfter "AddTableHere"
.Content.Find.Execute FindText:="AddTableHere", ReplaceWith:="^c"
End With
Has anyone any suggestions on how I could do this? 有没有人建议我该怎么做?
Thanks 谢谢
Word中的Selection
对象具有一个PasteExcelTable
方法,该方法可能符合要求-有关详细信息,请参见MSDN 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.