This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Pipeline as Code and have Mohamed Labouardy on-line!
See this thread for details.
Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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: 24203
44
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: 26481
81
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.
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic