LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default stop error message

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



--
phil in da uk
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stop error message when opening a non existant file in a macro swar phil Excel Discussion (Misc queries) 1 March 22nd 10 02:35 PM
stop error message "too many different cell formats" Judy Excel Worksheet Functions 1 May 7th 09 05:31 PM
#NAME? - is there a way to stop this error message? m@cr0 Excel Discussion (Misc queries) 3 July 23rd 08 03:17 PM
How to stop a recurrent circular reference error message ? DaveWB3DWE Excel Discussion (Misc queries) 1 August 10th 07 05:10 PM
Stop error message Oggy Excel Discussion (Misc queries) 0 April 15th 07 04:26 PM


All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"