Stuart McLachlan
stuart at lexacorp.com.pg
Thu Jul 16 06:51:09 CDT 2009
Two options: If you *really* want to find the path to the executable, you can walk the registry - I've got it somewhere in my toolbox. Let me know if you really want to and I will dig it up. But it's much easier to leave it up to the Shell to decide where to find the appropriate application. Public Declare Function ShellExecute Lib "SHELL32.DLL" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long ShellExecute Application.hWndAccessApp, "Open", strDocName, "", "", vbNormalFocus -- Stuart On 16 Jul 2009 at 11:19, Max Wanadoo wrote: > Hi List, > Is there any way I can find out in code where any of the office applications > are installed? > > This works if I put the path for the application in by long-hand, but how > can I find out what the path to the application is and store it to a > variable. > > const conQuote as string = """ > > MsgBox "The PDF file will now open to show you total Disbursements. > Please print and file this." & vbCrLf & "Please then select the matching CSV > file to decrypt and process" > strShell = conQuote & "C:\Program Files\Adobe\Reader > 8.0\Reader\AcroRd32.exe " & conQuote > strShell = strShell & " " & conQuote & strPathPDFFile & conQuote > RetVal = Shell(strShell, 1) > > If it was a Word document I wanted to open I would be looking for somthing > like: > strDocName = "c:\mydocs\procedure.doc" > strWord = specialpathfolder("Word") ' assuming that this returned the > qualified pathname.. > strshell = conquote & strword & conquote & " " & strDocName & conquote > retval = shell(strshell,1) > > Thanks > Max > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com