Find Excel path

  • Thread starter Thread starter Lieven Mettepenningen
  • Start date Start date
L

Lieven Mettepenningen

Hello,

could anyone tell me how to find the exact path of the Excel application in
the registry, independent of the Office version installed on the PC?

Thx,

Lieven
 
I suspect I may be being a "spoilt corporate" gere (only
having work with fairly recent vwersions) - so I dont know
when:

Application.Path

was implemented.



ttfn benm
 
Lieven,

Bit confused on the question.

The registry will only reflect versions of Excel that have been installed.
It may have old data there, but it won't have anything about versions that
have not been installed.

Can you be more specific?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I know it is available in xl97 and later and suspect it has been available
since xl5.
 
If you're not running this from excel, something like this will give you the
default program associated with .xls files.

Option Explicit
Public Declare Function FindExecutable Lib "shell32.dll" _
Alias "FindExecutableA" ( _
ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As String) As Long

Sub FindXLSprogram()
Dim FName As String
Dim ExeName As String
Dim Pos As Integer
Dim Path As String
Dim FileNumber As Long

ExeName = String(255, 0)
FName = Environ("temp") & "\someuniquenamegoeshere.xls"

FileNumber = FreeFile
On Error Resume Next
Kill FName
On Error GoTo 0

Open FName For Append As FileNumber
Close FileNumber

FindExecutable FName, "", ExeName

On Error Resume Next
Kill FName
On Error GoTo 0

Pos = InStrRev(ExeName, "\")
Path = Left(ExeName, Pos - 1)

Debug.Print "Full File Name: " & ExeName
Debug.Print "Folder Name: " & Path

End Sub


(Lots of this was stolen from a post by Chip Pearson.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top