Andy Lacey
andy at minstersystems.co.uk
Wed Jun 25 01:33:55 CDT 2008
Hi Tina My suggestion is to create a module and put this RunApp function in it -------------------------------------------------- Declare Function ShellExecute Lib "shell32" 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 Function RunApp(strFile As String, bytSize) As Boolean Dim lngRet As Long Dim varTaskID As Variant Dim strRet As String lngRet = ShellExecute(hWndAccessApp, vbNullString, strFile, vbNullString, vbNullString, bytSize) If lngRet > Success Then strRet = vbNullString lngRet = -1 RunApp = True Else RunApp = False Select Case lngRet Case NotRegistered varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & strFile, bytSize) lngRet = (varTaskID <> 0) Case InadequateMemory MsgBox "Error: Out of Memory/Resources!" Case FileNotFound MsgBox "Error: File not found!" Case PathNotFound MsgBox "Error: Path not found!" Case BadFormat MsgBox "Error: Bad File Format!" Case 5 MsgBox "Error: Unauthorized due to Security restrictions!" End Select End If End Function ------------------------------------------------ Then you can open a Word doc, an Excel sheet, a PDF or anything else just by a simple call to that, ie Call RunApp("C:\Wherever\Whatever.doc", 1) -- Andy Lacey http://www.minstersystems.co.uk >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of >Tina Norris Fields >Sent: 24 June 2008 23:11 >To: AccessD at databaseadvisors.com >Subject: [AccessD] How to get my Word document open > > >Hi Group, > >Again, I know I've seen something on this before, but what >I've found so >far doesn't quite work, so I'm looking for help. > >On my form, I have a nice button that will launch Word for me, but I >want it to open a particular document. The things I have tried so far >are not working. So, once again I turn to this knowledgeable >group for >assistance. How do I make Access launch Word and open a >specific document? > >Thanks for your help, >Tina >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com > >