These VBA macros open Word, PowerPoint and other programs straight from Excel, and copy the selected cells into a new Word document in one step.
Works inExcel 2010 and later, Windows and Mac
UndoNot possible. Save a copy first
Save asMacro-Enabled Workbook (.xlsm)
New to macros? See how to use the macros on this site: copy the code, paste it into a module with Alt + F11, and run it with Alt + F8.
Table of Contents
Open Word with a new document
Sub OpenWord()
Dim wd As Object
Set wd = CreateObject("Word.Application")
wd.Visible = True
wd.Documents.Add
End Sub
Copy the selection into a new Word document
Sub SelectionToWord()
Dim wd As Object
Selection.Copy
Set wd = CreateObject("Word.Application")
wd.Visible = True
wd.Documents.Add.Content.Paste
Application.CutCopyMode = False
End Sub
The cells arrive in Word as a formatted table, ready for a letter or report.
Open PowerPoint
Sub OpenPowerPoint()
Dim pp As Object
Set pp = CreateObject("PowerPoint.Application")
pp.Visible = True
pp.Presentations.Add
End Sub
Open Notepad or Calculator
Sub OpenNotepad()
Shell "notepad.exe", vbNormalFocus
End Sub
Sub OpenCalculator()
Shell "calc.exe", vbNormalFocus
End Sub
Things to know
CreateObjectworks without setting any references, so the code runs on any PC with Office installed.- These macros are for Excel on Windows.
Shellprogram names are Windows-only. - To email instead, see the email through Outlook macro.