mangodango
New Member
- Joined
- Aug 8, 2017
- Messages
- 9
Hello, I was thinking about the VBA macro for exporting a range from Excel to Word document. Following macro seems to be doing it, although I have a problem with the pasted size. The data copied from Excel is too big for a Word document. Is there any way to adjust the copy/paste size, so copied Excel range would fit into the doc?
Many thanks for your insights.
Many thanks for your insights.
Code:
Sub export_excel_to_word() Set obj = CreateObject("Word.Application")
obj.Visible = True
Set newobj = obj.Documents.Add
ActiveSheet.UsedRange.Copy
newobj.Range.Paste
Application.CutCopyMode = False
obj.Activate
newobj.SaveAs Filename:=Application.ActiveWorkbook.Path & "\" & ActiveSheet.Name
End Sub