簡體   English   中英

如何將Excel中的數據復制到Word中並保持其格式

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM