I have been trying to copy text from excel in to word, and retain the bold formatting on the text, but not the cell. 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
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.Inse开发者_开发技巧rtAfter "AddTableHere"
.Content.Find.Execute FindText:="AddTableHere", ReplaceWith:="^c"
End With
Has anyone any suggestions on how I could do this?
Thanks
The Selection
object in Word has a PasteExcelTable
method which might fit the bill - see MSDN for details
精彩评论