I want to copy several ranges in a workbook to one Word document. How do I do that with a VBA?
In this example, I have defined the ranges with names. In "sheet3", I want range F3:F20 to be cells that users can type in which name ranges they want to export to Word.
This code does work if the named range is in the same sheet as the button. But I need it to work when the named ranges are in another sheets.
I also need this code to copy next named range valued in the F3 cell, and down to end of list.
I appreciate your help
- Private Sub CommandButton3_Click()
- Dim WordApp As Word.Application
- Dim WordDoc As Word.Document
- Set WordApp = New Word.Application
- Set WordDoc = WordApp.Documents.Add
- Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
- WordApp.Visible = True
- Set objSelection = WordApp.Selection
- End Sub