Prev: iexplor is opening with default website when file not found in ms-access
Next: Global Warming and what you can do to against it
From: Naushad on 31 Jan 2010 03:25 Hi All, I have written a VBA code to open a word file in iexplore by the shell command. If the file is not found a message is displayed and the internet explorer is opened. I want to display the custom message and don't want to open the iexplore. My code are as follows Private Sub cmdReport_Click() On Error GoTo Err_cmdReport_Click Dim VarPath As String Dim VarReport As String Dim varRepDate As Variant Dim VarCon As String VarPath = "C:\Documents and Settings\nhaider\Desktop\" varRepDate = Format$(Me.ReportDate, "dd\-mm\-yy") VarReport = varRepDate & "@" & Me.Project__ & ".doc" VarCon = VarPath & VarReport Shell "C:\Program Files\Internet Explorer\iexplore.exe " & VarCon, vbMaximizedFocus Me.ReportDate.SetFocus Exit_cmdReport_Click: Exit Sub Err_cmdReport_Click: MsgBox Err.Description Resume Exit_cmdReport_Click End Sub Please help me to solve this problem. Thanks in advance Naushad
From: Benny Andersen on 31 Jan 2010 04:50 if len(dir(VarCon)) then shell .... else msgbox .... endif
From: Naushad on 1 Feb 2010 00:38
On Jan 31, 12:50 pm, Benny Andersen <a.mail.u...(a)gmail.com> wrote: > if len(dir(VarCon)) then > shell .... > else > msgbox .... > endif Thank you very much. It is working properly. |