PDA

View Full Version : VBA format Word



hhn
05-10-2018, 02:31 PM
hello, I'm using the following codes to copy from Excel to Word. But the table in Word is really wide. What kind of codes do I need to minimize the table when they get copied over? Thanks


Sub export_excel_to_word()
Set obj = CreateObject("Word.Application")
obj.Visible = True
Set newObj = obj.Documents.Add
ActiveSheet.Range("A3:c40").Copy
newObj.Range.Paste
Application.CutCopyMode = False
obj.Activate
newObj.SaveAs Filename:=Application.ActiveWorkbook.Path & "" & ActiveSheet.Name
End Sub