Msg Box

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Hi all. What I am trying to do is put an Msg Box into this script. If the file is located and (aa1)=713 it works. When the file is found and (aa1) is not equal to 713 it works. But if the file (Upe202.exe) is missing completely, I receive a run time error File not found. Any help would be appreciated. Thanks Dan


Private Sub Workbook_Open()
Workbooks.Open Filename:="C:windowsUpe202.xls"
If Range("AA1") = "713" Then
ActiveWorkbook.Close
Else
On Error Resume Next
ActiveWorkbook.Close
Call MsgBox("Set Up Req", 16, "Error")
ActiveWorkbook.Close
ActiveWorkbook.Close
End If
End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi to see if a file exists use DIR.

Example

If dir(c:filename.xls)="" then
msgbox "file not found"
exit sub
end if
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,822
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top