Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default On Error Resume Next not working (2010)

Here's a code snippet that has worked for years under 2003:

strFullName = strPath & subPath & varBookName
Err.Clear
On Error Resume Next
Workbooks.Open FileName:=strFullName, _
UpdateLinks:=0 'do not update
Select Case Err.Number

Now, under 2010 if the file does not exist I get a dialog that displays
the filename as "not found, etc, etc." When I click on OK, the code
continues executing and does what I expect. Is there a setting change
on 2010 or something that I'm missing?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default On Error Resume Next not working (2010)

I don't use 2010, but I would check how excel is set up to handle
errors:

In the VBA editor goto Tools Options General Error Handling:
Select 'Break on Unhandled Errors'

Regards,
Per

On 7 Nov., 02:06, "Clif McIrvin" wrote:
Here's a code snippet that has worked for years under 2003:

* * strFullName = strPath & subPath & varBookName
* * Err.Clear
* * On Error Resume Next
* * Workbooks.Open FileName:=strFullName, _
* * * * UpdateLinks:=0 * * * * 'do not update
* * Select Case Err.Number

Now, under 2010 if the file does not exist I get a dialog that displays
the filename as "not found, etc, etc." *When I click on OK, the code
continues executing and does what I expect. *Is there a setting change
on 2010 or something that I'm missing?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default On Error Resume Next not working (2010)

On Nov 6, 8:06*pm, "Clif McIrvin" wrote:
Here's a code snippet that has worked for years under 2003:

* * strFullName = strPath & subPath & varBookName
* * Err.Clear
* * On Error Resume Next
* * Workbooks.Open FileName:=strFullName, _
* * * * UpdateLinks:=0 * * * * 'do not update
* * Select Case Err.Number

Now, under 2010 if the file does not exist I get a dialog that displays
the filename as "not found, etc, etc." *When I click on OK, the code
continues executing and does what I expect. *Is there a setting change
on 2010 or something that I'm missing?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


I would check to be sure you have turned off displaying messages to
the user
Application.DisplayAlerts = False

Steve
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default On Error Resume Next not working (2010)

On Nov 7, 1:06*am, "Clif McIrvin" wrote:
Here's a code snippet that has worked for years under 2003:

* * strFullName = strPath & subPath & varBookName
* * Err.Clear
* * On Error Resume Next
* * Workbooks.Open FileName:=strFullName, _
* * * * UpdateLinks:=0 * * * * 'do not update
* * Select Case Err.Number

Now, under 2010 if the file does not exist I get a dialog that displays
the filename as "not found, etc, etc." *When I click on OK, the code
continues executing and does what I expect. *Is there a setting change
on 2010 or something that I'm missing?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


Cliff

Why not check if the file exists using Dir rather than using On Error?

If Dir(strFullName)<"" Then
Set wbOpen = Workbooks.Open(FileName:=strFullName,
UpdateLinks:=0)
Else
Msgbox "File not found, check filename and path."
End If
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default On Error Resume Next not working (2010)

"norie" wrote in message
...
On Nov 7, 1:06 am, "Clif McIrvin" wrote:
Here's a code snippet that has worked for years under 2003:

strFullName = strPath & subPath & varBookName
Err.Clear
On Error Resume Next
Workbooks.Open FileName:=strFullName, _
UpdateLinks:=0 'do not update
Select Case Err.Number

Now, under 2010 if the file does not exist I get a dialog that
displays
the filename as "not found, etc, etc." When I click on OK, the code
continues executing and does what I expect. Is there a setting change
on 2010 or something that I'm missing?

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


Cliff

Why not check if the file exists using Dir rather than using On Error?

If Dir(strFullName)<"" Then
Set wbOpen = Workbooks.Open(FileName:=strFullName,
UpdateLinks:=0)
Else
Msgbox "File not found, check filename and path."
End If


---------

Works like a charm! Thanks for the tip.
I like the concept better than what I was doing, too.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


Reply
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
On error resume next not working cluckers Excel Discussion (Misc queries) 3 November 25th 09 08:12 PM
year 2010 not working in IF SLP Excel Discussion (Misc queries) 2 December 13th 07 06:29 PM
On Error Resume Next ? Nigel Excel Programming 4 August 11th 05 09:07 AM
On Error Resume Next Nigel Excel Programming 3 August 10th 05 03:34 PM
"on error resume next" NOT working... Chris M Excel Programming 2 July 13th 05 10:30 PM


All times are GMT +1. The time now is 05:44 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"