[英]How do I copy Data from a excel in to word and keep its formatting
我一直在嘗試將文本從excel中復制到word中,並保留文本的粗體格式,但不保留單元格的格式。 當我嘗試手動復制並粘貼到單元格上時,將復制文本,而不是單元格本身。 當我嘗試使用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
有沒有人建議我該怎么做?
謝謝
Word中的Selection
對象具有一個PasteExcelTable
方法,該方法可能符合要求-有關詳細信息,請參見MSDN 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.