View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
phil phil is offline
external usenet poster
 
Posts: 201
Default Stop Error Message

I am trying to control how the workbook is opened programatically
but I'm not sure how the 'on error resume next' is supposed to work
...where would I insert this in the code below? Thanks.

"ben" wrote:

are you trying to open the workbook programmatically or is it a user chosen
opening? it sounds like you are trying programmatically. If that is the case
you could always make sure Excel chooses the correct workbook. If not try
on error resume next
statement


"phil" wrote:

I have code written (see below) that makes sure if a workbook (TMR.xls)
is called something else or isnot located in the right folder (TMR folder),
then it will not open. It works fine if the workbook has been located in
another folder. But, if it has the wrong name and is in the TMR folder, a
Visual Basic Error message appears saying it can't locate the workbook, AND
THEN OPENS IT !!!! The visual basic error is preventing the rest of the code,
which would close the workbook. any suggestions how to get around this? Your
help will be appreciated.

code=

If ActiveWorkbook.FullName = "C:\TMR\TMR.xls" Then
Sheets("MENU").Select
Else
Sheets("End").Select
Application.ActiveWorkbook.Save
Application.Quit

Your help is much needed and appreciated


--
phil in da uk