End
Votez pour moa je veux être mvp à la place du mvp...
'********************************************************
Public Sub KillXL()
'********************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture d'XL
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject(, "Excel.application")
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'********************************************************
Public Sub QuitExcel(Instance As Object)
'********************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
"Yann" a écrit dans le message de
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier excel
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours (parfois
ça marche, parfois non) et reste donc dans le gestionnaire
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
End
Votez pour moa je veux être mvp à la place du mvp...
'********************************************************
Public Sub KillXL()
'********************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture d'XL
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject(, "Excel.application")
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'********************************************************
Public Sub QuitExcel(Instance As Object)
'********************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
"Yann" <yann.thiebaut@np.ge.cum> a écrit dans le message de
news:33b601c47eae$093fc540$a401280a@phx.gbl...
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier excel
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours (parfois
ça marche, parfois non) et reste donc dans le gestionnaire
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
End
Votez pour moa je veux être mvp à la place du mvp...
'********************************************************
Public Sub KillXL()
'********************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture d'XL
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject(, "Excel.application")
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'********************************************************
Public Sub QuitExcel(Instance As Object)
'********************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
"Yann" a écrit dans le message de
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier excel
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours (parfois
ça marche, parfois non) et reste donc dans le gestionnaire
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
-----Message d'origine-----
Normal... Je nje t'ai pas donné la procédure gest
Tu devrais, remplace la mienne par la tienne ou vire la
-----Message d'origine-----
Normal... Je nje t'ai pas donné la procédure gest
Tu devrais, remplace la mienne par la tienne ou vire la
-----Message d'origine-----
Normal... Je nje t'ai pas donné la procédure gest
Tu devrais, remplace la mienne par la tienne ou vire la
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
ResumeOut Then Screen.MousePointer = vbNormal:
Else
End
End If
out:
End Sub
"Yann" a écrit dans le
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
ResumeOut Then Screen.MousePointer = vbNormal:
Else
End
End If
out:
End Sub
"Yann" <yann.thiebaut@np.ge.cum> a écrit dans le
news:33b601c47eae$093fc540$a401280a@phx.gbl...
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:=False
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
ResumeOut Then Screen.MousePointer = vbNormal:
Else
End
End If
out:
End Sub
"Yann" a écrit dans le
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Else
End
End If
out:
End Sub
"Yann" a écrit dans le
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Else
End
End If
out:
End Sub
"Yann" <yann.thiebaut@np.ge.cum> a écrit dans le
news:33b601c47eae$093fc540$a401280a@phx.gbl...
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
Public Sub KillXL()
'*******************************************************
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
Public Sub QuitExcel(Instance As Object)
'*******************************************************
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Else
End
End If
out:
End Sub
"Yann" a écrit dans le
news:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
ça marche, parfois non) et reste donc dans le
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
> End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a écrit :
> Votez pour moa je veux être mvp à la place du mvp...
>
> '********************************************************
> Public Sub KillXL()
> '********************************************************
> On Error GoTo LocalError
> Dim PrevInstance As Object
> Dim Count As Integer
>
> '**** Si XL est en cours d'utilisation -> Fermeture d'XL
> Do
> Set PrevInstance = Nothing
> On Error Resume Next
> Set PrevInstance = GetObject(, "Excel.application")
> On Error GoTo LocalError
> If Not PrevInstance Is Nothing Then
> 'MsgBox "Fermeture d'Excel"
> Call QuitExcel(PrevInstance)
> End If
> Count = Count + 1
> If Count = 5 Then Exit Do
> Loop
>
> DoEvents
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
> Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
> '********************************************************
> Public Sub QuitExcel(Instance As Object)
> '********************************************************
> On Error GoTo LocalError
> Dim WB As Workbook
> If Not Instance Is Nothing Then
> On Error Resume Next
> Instance.DisplayAlerts = False
> For Each WB In Instance.Workbooks
> WB.Close
> Next
> Instance.Quit
> On Error GoTo LocalError
> Set WB = Nothing
> Set Instance = Nothing
> End If
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
>
>
> "Yann" a écrit dans le message de
> news:33b601c47eae$093fc540$
> Bonjour,
>
> J'ai un problème similaire en VB, j'ouvre un fichier excel
> pour faire des calculs, mais lorsque je veux fermer la
> liaison, le processus ne se termine pas toujours (parfois
> ça marche, parfois non) et reste donc dans le gestionnaire
> des tâches.
>
>
> J'ouvre avec :
>
> Set appex2 = CreateObject("excel.Application")
> Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
> True, , , , , , , , False)
>
>
> En gros je fais pour fermer :
>
> Set appex2 = GetObject(, "excel.Application")
> exl2.Close SaveChanges:úlse
> appex2.Quit
> Set exl2 = Nothing
> Set appex2 = Nothing
>
> Merci d'avance pour votre aide.
> Cordialement.
> Yann
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
> End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a écrit :
> Votez pour moa je veux être mvp à la place du mvp...
>
> '********************************************************
> Public Sub KillXL()
> '********************************************************
> On Error GoTo LocalError
> Dim PrevInstance As Object
> Dim Count As Integer
>
> '**** Si XL est en cours d'utilisation -> Fermeture d'XL
> Do
> Set PrevInstance = Nothing
> On Error Resume Next
> Set PrevInstance = GetObject(, "Excel.application")
> On Error GoTo LocalError
> If Not PrevInstance Is Nothing Then
> 'MsgBox "Fermeture d'Excel"
> Call QuitExcel(PrevInstance)
> End If
> Count = Count + 1
> If Count = 5 Then Exit Do
> Loop
>
> DoEvents
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
> Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
> '********************************************************
> Public Sub QuitExcel(Instance As Object)
> '********************************************************
> On Error GoTo LocalError
> Dim WB As Workbook
> If Not Instance Is Nothing Then
> On Error Resume Next
> Instance.DisplayAlerts = False
> For Each WB In Instance.Workbooks
> WB.Close
> Next
> Instance.Quit
> On Error GoTo LocalError
> Set WB = Nothing
> Set Instance = Nothing
> End If
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
>
>
> "Yann" <yann.thiebaut@np.ge.cum> a écrit dans le message de
> news:33b601c47eae$093fc540$a401280a@phx.gbl...
> Bonjour,
>
> J'ai un problème similaire en VB, j'ouvre un fichier excel
> pour faire des calculs, mais lorsque je veux fermer la
> liaison, le processus ne se termine pas toujours (parfois
> ça marche, parfois non) et reste donc dans le gestionnaire
> des tâches.
>
>
> J'ouvre avec :
>
> Set appex2 = CreateObject("excel.Application")
> Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
> True, , , , , , , , False)
>
>
> En gros je fais pour fermer :
>
> Set appex2 = GetObject(, "excel.Application")
> exl2.Close SaveChanges:úlse
> appex2.Quit
> Set exl2 = Nothing
> Set appex2 = Nothing
>
> Merci d'avance pour votre aide.
> Cordialement.
> Yann
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
> End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a écrit :
> Votez pour moa je veux être mvp à la place du mvp...
>
> '********************************************************
> Public Sub KillXL()
> '********************************************************
> On Error GoTo LocalError
> Dim PrevInstance As Object
> Dim Count As Integer
>
> '**** Si XL est en cours d'utilisation -> Fermeture d'XL
> Do
> Set PrevInstance = Nothing
> On Error Resume Next
> Set PrevInstance = GetObject(, "Excel.application")
> On Error GoTo LocalError
> If Not PrevInstance Is Nothing Then
> 'MsgBox "Fermeture d'Excel"
> Call QuitExcel(PrevInstance)
> End If
> Count = Count + 1
> If Count = 5 Then Exit Do
> Loop
>
> DoEvents
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "KillXL", Params.PathLog) = ResumeOut
> Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
> '********************************************************
> Public Sub QuitExcel(Instance As Object)
> '********************************************************
> On Error GoTo LocalError
> Dim WB As Workbook
> If Not Instance Is Nothing Then
> On Error Resume Next
> Instance.DisplayAlerts = False
> For Each WB In Instance.Workbooks
> WB.Close
> Next
> Instance.Quit
> On Error GoTo LocalError
> Set WB = Nothing
> Set Instance = Nothing
> End If
> Exit Sub
> '******************************************
> LocalError:
> '******************************************
> If GestError(Err, Me.Name, "QuitExcel", Params.PathLog) > > ResumeOut Then Screen.MousePointer = vbNormal: Resume out
> Else
> End
> End If
> out:
> End Sub
>
>
> "Yann" a écrit dans le message de
> news:33b601c47eae$093fc540$
> Bonjour,
>
> J'ai un problème similaire en VB, j'ouvre un fichier excel
> pour faire des calculs, mais lorsque je veux fermer la
> liaison, le processus ne se termine pas toujours (parfois
> ça marche, parfois non) et reste donc dans le gestionnaire
> des tâches.
>
>
> J'ouvre avec :
>
> Set appex2 = CreateObject("excel.Application")
> Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
> True, , , , , , , , False)
>
>
> En gros je fais pour fermer :
>
> Set appex2 = GetObject(, "excel.Application")
> exl2.Close SaveChanges:úlse
> appex2.Quit
> Set exl2 = Nothing
> Set appex2 = Nothing
>
> Merci d'avance pour votre aide.
> Cordialement.
> Yann
JAMAIS de End. Cela consiste à tuer ton application de la même façon
que par le stop sous VB. Il n'y a aucune libération de ressource, de
connexions, et j'en passe.
Le End doit être enlevé et tu dois t'arranger à sortir de toutes tes
fonctions/forms en libérant les ressources (par des unload si
nécessaire ou set=nothing)etc....jusqu'à arriver à la form de départ,
celle qui a été le départ de ton appli. Là, et seulement là, tu peux
envoyer le signal "close" pour quitter ton application (ce n'est bien
sûr pas nécessaire si l'utilisateur a cliqué sur la croix).
"Yann" a écrit dans le message
de news: 348401c47ebe$ff04b0c0$
Que me conseillez vous à la place du end ?
Je n'ai malheureusement pas accès au site FAQ VB que vous
donnez... (ce site est bloqué par ma boîte...)
Merci d'avance.
Yann-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
écrit :Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
*Public Sub KillXL()
'*******************************************************
*On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
d'XLDo
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
(, "Excel.application")On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Params.PathLog) = ResumeOutThen Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
*Public Sub QuitExcel(Instance As Object)
'*******************************************************
*On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Params.PathLog) >>> ResumeOut Then Screen.MousePointer = vbNormal:
Resume outElse
End
End If
out:
End Sub
"Yann" a écrit dans le
message denews:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
excelpour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
(parfoisça marche, parfois non) et reste donc dans le
gestionnairedes tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
JAMAIS de End. Cela consiste à tuer ton application de la même façon
que par le stop sous VB. Il n'y a aucune libération de ressource, de
connexions, et j'en passe.
Le End doit être enlevé et tu dois t'arranger à sortir de toutes tes
fonctions/forms en libérant les ressources (par des unload si
nécessaire ou set=nothing)etc....jusqu'à arriver à la form de départ,
celle qui a été le départ de ton appli. Là, et seulement là, tu peux
envoyer le signal "close" pour quitter ton application (ce n'est bien
sûr pas nécessaire si l'utilisateur a cliqué sur la croix).
"Yann" <anonymous@discussions.microsoft.com> a écrit dans le message
de news: 348401c47ebe$ff04b0c0$a401280a@phx.gbl...
Que me conseillez vous à la place du end ?
Je n'ai malheureusement pas accès au site FAQ VB que vous
donnez... (ce site est bloqué par ma boîte...)
Merci d'avance.
Yann
-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?
End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
écrit :
Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
*
Public Sub KillXL()
'*******************************************************
*
On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
d'XL
Do
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
(, "Excel.application")
On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Params.PathLog) = ResumeOut
Then Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
*
Public Sub QuitExcel(Instance As Object)
'*******************************************************
*
On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Params.PathLog) >>> ResumeOut Then Screen.MousePointer = vbNormal:
Resume out
Else
End
End If
out:
End Sub
"Yann" <yann.thiebaut@np.ge.cum> a écrit dans le
message de
news:33b601c47eae$093fc540$a401280a@phx.gbl...
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
excel
pour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
(parfois
ça marche, parfois non) et reste donc dans le
gestionnaire
des tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.
JAMAIS de End. Cela consiste à tuer ton application de la même façon
que par le stop sous VB. Il n'y a aucune libération de ressource, de
connexions, et j'en passe.
Le End doit être enlevé et tu dois t'arranger à sortir de toutes tes
fonctions/forms en libérant les ressources (par des unload si
nécessaire ou set=nothing)etc....jusqu'à arriver à la form de départ,
celle qui a été le départ de ton appli. Là, et seulement là, tu peux
envoyer le signal "close" pour quitter ton application (ce n'est bien
sûr pas nécessaire si l'utilisateur a cliqué sur la croix).
"Yann" a écrit dans le message
de news: 348401c47ebe$ff04b0c0$
Que me conseillez vous à la place du end ?
Je n'ai malheureusement pas accès au site FAQ VB que vous
donnez... (ce site est bloqué par ma boîte...)
Merci d'avance.
Yann-----Message d'origine-----
Salut,
Où est défini GestError() ? Et al constance ResumeOut ?End
Quelle horreur :) !!!
Ne JAMAIS utiliser End ! ;)
Consulte la FAQ pour plus d'infos, c'est tjrs la même
chose.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/
Laurent Jordi (www.ezlogic.mc) <inf[o]@ezlogic.mc> a
écrit :Votez pour moa je veux être mvp à la place du mvp...
'*******************************************************
*Public Sub KillXL()
'*******************************************************
*On Error GoTo LocalError
Dim PrevInstance As Object
Dim Count As Integer
'**** Si XL est en cours d'utilisation -> Fermeture
d'XLDo
Set PrevInstance = Nothing
On Error Resume Next
Set PrevInstance = GetObject
(, "Excel.application")On Error GoTo LocalError
If Not PrevInstance Is Nothing Then
'MsgBox "Fermeture d'Excel"
Call QuitExcel(PrevInstance)
End If
Count = Count + 1
If Count = 5 Then Exit Do
Loop
DoEvents
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "KillXL",
Params.PathLog) = ResumeOutThen Screen.MousePointer = vbNormal: Resume out
Else
End
End If
out:
End Sub
'*******************************************************
*Public Sub QuitExcel(Instance As Object)
'*******************************************************
*On Error GoTo LocalError
Dim WB As Workbook
If Not Instance Is Nothing Then
On Error Resume Next
Instance.DisplayAlerts = False
For Each WB In Instance.Workbooks
WB.Close
Next
Instance.Quit
On Error GoTo LocalError
Set WB = Nothing
Set Instance = Nothing
End If
Exit Sub
'******************************************
LocalError:
'******************************************
If GestError(Err, Me.Name, "QuitExcel",
Params.PathLog) >>> ResumeOut Then Screen.MousePointer = vbNormal:
Resume outElse
End
End If
out:
End Sub
"Yann" a écrit dans le
message denews:33b601c47eae$093fc540$
Bonjour,
J'ai un problème similaire en VB, j'ouvre un fichier
excelpour faire des calculs, mais lorsque je veux fermer la
liaison, le processus ne se termine pas toujours
(parfoisça marche, parfois non) et reste donc dans le
gestionnairedes tâches.
J'ouvre avec :
Set appex2 = CreateObject("excel.Application")
Set exl2 = appex2.Workbooks.Open(nomfich2, 0,
True, , , , , , , , False)
En gros je fais pour fermer :
Set appex2 = GetObject(, "excel.Application")
exl2.Close SaveChanges:úlse
appex2.Quit
Set exl2 = Nothing
Set appex2 = Nothing
Merci d'avance pour votre aide.
Cordialement.
Yann
.