Urgent : Détection de la présence d'un objet

bigboy2g15 Messages postés 66 Date d'inscription mercredi 31 mars 2004 Statut Membre Dernière intervention 3 juin 2004 - 2 juin 2004 à 16:23
econs Messages postés 4030 Date d'inscription mardi 13 mai 2003 Statut Membre Dernière intervention 23 décembre 2008 - 2 juin 2004 à 16:59
Je voudrais si il existait un equivalent de isnull en isnothing

C'est pour une gestion d'erreur genre :


on error goto prob

set wd = new word.application

wd.add(adr_fic)

set exl = new excel.applicaton
exl.add(adr_fic2)

exit sub

prob:

set wd = nothing
set exl = nothing



Si ici une erreur survient à wd.add, l'application va planter à set exl = nothing.

Donc je voudrai détecter si une variable existe ou non, d'ou le isnothing (qui ne marche pas)

Si quelqu'un a une solution, je le remrecie d'avance.

1 réponse

econs Messages postés 4030 Date d'inscription mardi 13 mai 2003 Statut Membre Dernière intervention 23 décembre 2008 24
2 juin 2004 à 16:59
prob:
select case Err.Number
case 91: 
MsgBox "L'objet n'existe pas"
End select


Manu
0
Rejoignez-nous