Hello all,

Forgive my ignorance but I could really use some help with writing a Word macro to open an Excel spreadsheet. Long story short is that our firm has a multitude of global (corporate) word macros that we use to open different documents and other functions. We now have an excel spreadsheet that we would like to add to that list of macros so that they can all be accessed from one simple toolbar menu in Word. Please tell me that I can have a macro in word that will open Excel with that spreadsheet? If so, can you give me a sample code for that macro?

Thank you so very much!

jgassmann@ahlerslaw.com

To open Excel:

Sub OpenExcel()
' OpenExcel Macro
  Shell ("D:\Program Files\Microsoft Office\Office10\excel.exe")
End Sub

To open Excel with a file:

Sub OpenExcel()
' OpenExcel Macro
  Shell ("D:\Program Files\Microsoft Office\Office10\excel.exe ""D:\My Documents\Countries.xls""")
End Sub

Of course, modify paths to match yours.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.