• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Locating Microsoft Excel executable

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,

Is there an easy way to determine the location of the Microsoft Excel executable on a Windows machine? For example, from my experience given different versions of Microsoft Office, the installation path was either C:\Program Files\Microsoft Office\Office10 or C:\Program Files\Microsoft Office\Office11 (or something close to this).

Short of doing a search (in my Java code) for the excel.exe file at the start of the application using a default list of known possible directory locations, is there an easier way to find the Excel executable?

Thanks,
Dave
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Throw up a dialog box and have the user find it?
 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Throw up a dialog box and have the user find it?



That's exactly what I was kind of hoping to avoid, but certainly an option. I was hoping to reduce the need to prompt the user and extract the executable location automatically.

Thanks for the response.

Dave
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you want to find that location? If you want to find it so you can use Excel to display an XLS file, the standard way is to use the Windows "start" command. It looks like "start abc.xls" on the command line. That way Windows takes care of finding it.
 
David Irwin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
Why do you want to find that location? If you want to find it so you can use Excel to display an XLS file, the standard way is to use the Windows "start" command. It looks like "start abc.xls" on the command line. That way Windows takes care of finding it.



Ya, I would like to open Excel from within my Java app to display an Excel file that I'm editting.

Thanks for the response.

Dave
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very similar to Paul's "start" suggestion would be using RUNDLL32. Google for Java and RUNDLL32 for many examples. I honestly don't know any pros & cons of the two approaches. Maybe with RUNDLL32 you'd be able to attach to the input and output streams but for Excel that probably has no value.
reply
    Bookmark Topic Watch Topic
  • New Topic