Who is saying "file not found"? (Access, Windows, Excel)
Does "c:\Downloads\Domestic_Samples.xls" exists on the PCs where the error
occurs?
What does this display if you put it immediately before the Call Shell:
msgbox ">" & strfilename & "<" & vbcrlf & ">" & dir(strfilename) & "<"
BTW, you dont need the brackets around the SetWarning parameter.
-ok: DoSomething 99
-ok: Call DoSomething (99)
'DoSomething (99)' has a side-effect that will not affect what you're
doing, but is unnecessary.
HTH,
TC
"Kevin Webb" <(E-Mail Removed)> wrote in message
news:0f5c01c35a27$34d49fc0$(E-Mail Removed)...
> I hope someone can help me figure this out. I have the
> following code attached to a command button:
>
> Dim stAppName As String
> Dim strFileName As String
>
> 'Turn Warnings and MsgBoxes off
> DoCmd.SetWarnings (0)
>
> 'Set variables for application name and file name/path
> stAppName = "Excel.exe"
> strFileName = "c:\Downloads\Domestic_Samples.xls"
>
> 'Open Excel file through use of Shell command
> Call Shell(stAppName & " " & Chr(34) & strFileName &
> Chr(34), 1)
>
> It runs fine on my work PC and also another test PC. On
> two other PC's, it is returning a "File Not Found" error.
> I have not been able to recreate the error on any PC's I
> have available, so I am at a loss as to why this is
> occuring. If I can't fix this, I can't use it, so any
> help is greatly appreciated.
>
> BTW: This is in Access 97 on Windows NT boxes.
>
> Thanks
> Kevin Webb
> United Parcel Service
|