以下代码将单个值复制到 Word 中的书签中。我需要它来复制一系列值,例如“A6:G20”。
Sub test()
Dim objWord As Object
Dim ws As Worksheet
Set ws = Workbooks("Portfolio1").Sheets("Print")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open "D:Q.docx" ' change as required
With objWord.ActiveDocument
.Bookmarks("monthtable").Range.Text = ws.Range("C6").Value ' here I need range of values to be selected instead of a single cell
End With
Set objWord = Nothing
End Sub