Barb Reinhardt;278759 Wrote:
FWIW, I don't like using On Error GoTo err_hnd. I prefer to handle
errors
as they occur and build the program to handle it.
I'd do something like this
Set WS = nothing
On error resume next
Set WS = Worksheets("Festivi")
on error goto 0
If WS is nothing then
Msgbox("Worksheet not found.")
end if
Thanks for your tips,
the references of the project are all set correctly in SP3 and I've
supposed they are the same for SP2, but I'm not sure. This is the
complete list of my references:
Visual Basic for Application
Microsoft Excel Office 11.0 object Library
Ole Automation
Microsoft Forms 2.0 Object Library
Microsoft ActiveX Data Objects 2.5 Library
Microsoft Windows Common Control 6.0 (SP6)
Microsoft Office 11.0 Object Library
Microsoft Access 11.0 Object Library
I have just placed the Option Explicit at the beginning of the code and
compiled it, but the error remains. I think, however it is not related
with ADODB, but with the range selection.
Referring to your last message where you say you don't use the On error
goto method I'ld like to know where you place the code in the sub.
Set WS = nothing <--- is this my last statement in my sub?
On error resume next <---- then, in case of error, goes to Exit Sub?
Set WS = Worksheets("Festivi")
on error goto 0 <--- I've never used this
If WS is nothing then
Msgbox("Worksheet not found.")
end if
Thanks, Emiliano
--
eggpap
Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile:
http://www.thecodecage.com/forumz/member.php?userid=90
View this thread:
http://www.thecodecage.com/forumz/sh...ad.php?t=77743