UncleBajubjubs
Board Regular
- Joined
- Jul 11, 2017
- Messages
- 111
- Office Version
- 2010
Hello, I have a workbook with one worksheet which is intended to gather data from the other sheets, and then be exported as a word document. I don't have much experience with this, so i copied some code I found online:
But this gives me "Unexpected End Sub" on the first line. Any ideas, or just alternate code which will do what I need? Thanks!
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
But this gives me "Unexpected End Sub" on the first line. Any ideas, or just alternate code which will do what I need? Thanks!
Last edited by a moderator: