Je souhaite réaliser un traitement toutes les minutes dans un programme VBA,
or le composant timer n'existant pas (comme en VB6) et je ne sais pas
comment faire !
Je pense qu'avec les API windows ceci doit être possible.
Merci
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal
uElapse As Long, ByVal lpTimerFunc As Long)
If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then
Call KillTimer(Application.hwnd, 0)
End If
End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click()
Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc)
End Sub
--
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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un
programme VBA, or le composant timer n'existant pas (comme en VB6) et
je ne sais pas comment faire !
Je pense qu'avec les API windows ceci doit être possible.
Merci
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
JEROME BUNEL
Super Merci
"ng" a écrit dans le message de news:
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Super Merci
"ng" <ng@ngsoft-fr.com> a écrit dans le message de news:
ualjBywAFHA.2540@TK2MSFTNGP09.phx.gbl...
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As
Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal
uElapse As Long, ByVal lpTimerFunc As Long)
If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then
Call KillTimer(Application.hwnd, 0)
End If
End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click()
Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc)
End Sub
--
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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un
programme VBA, or le composant timer n'existant pas (comme en VB6) et
je ne sais pas comment faire !
Je pense qu'avec les API windows ceci doit être possible.
Merci
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
JEROME BUNEL
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.
Merci
"ng" a écrit dans le message de news:
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne
marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas
en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et
XP.
Merci
"ng" <ng@ngsoft-fr.com> a écrit dans le message de news:
ualjBywAFHA.2540@TK2MSFTNGP09.phx.gbl...
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As
Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal
uElapse As Long, ByVal lpTimerFunc As Long)
If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then
Call KillTimer(Application.hwnd, 0)
End If
End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click()
Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc)
End Sub
--
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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un
programme VBA, or le composant timer n'existant pas (comme en VB6) et
je ne sais pas comment faire !
Je pense qu'avec les API windows ceci doit être possible.
Merci
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.
Merci
"ng" a écrit dans le message de news:
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Jean Yves SÉVENO
Bonjour,
Oui, il y en a une.
Il faut tester la version de l'application et, si on est sous excel 97, utiliser une fonction créée à cet effet qui remplace l'opérateur AddressOf.
J'ai un fichier ou cette solution est mise en oeuvre.
Si tu me donnes une adresse, je te l'envoie.
Cordialement.
Jean Yves
"JEROME BUNEL" a écrit dans le message de news: ctllnk$a3j$
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.
Merci
"ng" a écrit dans le message de news:
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Bonjour,
Oui, il y en a une.
Il faut tester la version de l'application et, si on est sous excel 97,
utiliser une fonction créée à cet effet qui remplace l'opérateur AddressOf.
J'ai un fichier ou cette solution est mise en oeuvre.
Si tu me donnes une adresse, je te l'envoie.
Cordialement.
Jean Yves
"JEROME BUNEL" <j.bunel@mondragon-assembly.com> a écrit dans le message de
news: ctllnk$a3j$1@s1.news.oleane.net...
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne
marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas
en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et
XP.
Merci
"ng" <ng@ngsoft-fr.com> a écrit dans le message de news:
ualjBywAFHA.2540@TK2MSFTNGP09.phx.gbl...
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As
Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal
uElapse As Long, ByVal lpTimerFunc As Long)
If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then
Call KillTimer(Application.hwnd, 0)
End If
End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click()
Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc)
End Sub
--
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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un
programme VBA, or le composant timer n'existant pas (comme en VB6) et
je ne sais pas comment faire !
Je pense qu'avec les API windows ceci doit être possible.
Merci
Il faut tester la version de l'application et, si on est sous excel 97, utiliser une fonction créée à cet effet qui remplace l'opérateur AddressOf.
J'ai un fichier ou cette solution est mise en oeuvre.
Si tu me donnes une adresse, je te l'envoie.
Cordialement.
Jean Yves
"JEROME BUNEL" a écrit dans le message de news: ctllnk$a3j$
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.
Merci
"ng" a écrit dans le message de news:
Salut,
Dans un module :
Option explicit
Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) If MsgBox("Arreter le timer ?", vbYesNo + vbQuestion) = vbYes Then Call KillTimer(Application.hwnd, 0) End If End Sub
dans ta feuille :
Option Explicit
Private Sub CommandButton1_Click() Call SetTimer(Application.hwnd, 0, 2000, AddressOf TimerProc) End Sub
-- 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/
JEROME BUNEL wrote:
Je souhaite réaliser un traitement toutes les minutes dans un programme VBA, or le composant timer n'existant pas (comme en VB6) et je ne sais pas comment faire ! Je pense qu'avec les API windows ceci doit être possible. Merci
Alain CROS
Bonjour
Private Sub CommandButton1_Click() #If VBA6 Then Call SetTimer(0, 0, 2000, AddressOf TimerProc) #Else Call SetTimer(0, 0, 2000, AddressOf("TimerProc")) #End If End Sub
Le Application.hwnd a été remplacé par 0 car ça n'existe pas sur XL97. Le remplacer aussi dans Public Sub TimerProc
Coller ça dans un module.
Private Declare Function GetCurrentVbaProject& _ Lib "vba332" Alias "EbGetExecutingProj" _ (hProject&) Private Declare Function GetFuncID& _ Lib "vba332" Alias "TipGetFunctionId" _ (ByVal hProject&, ByVal strFunctionName$, ByRef strFunctionID$) Private Declare Function GetAddr& _ Lib "vba332" Alias "TipGetLpfnOfFunctionId" _ (ByVal hProject&, ByVal strFunctionID$, ByRef lpfnAddressOf&) #If VBA6 Then #Else Public Function AddrOf&(CallbackFunctionName$) 'AddressOf operator replacement for Office97 VBA 'Authors: Ken Getz and Michael Kaplan 'declaration of local variables Dim aResult&, CurrentVBProject&, strFunctionID$ Dim AddressOfFunction&, UnicodeFunctionName$ 'if the current VBProjects exists... If GetCurrentVbaProject(CurrentVBProject) = 0 Then Exit Function 'convert the name of the function to Unicode system UnicodeFunctionName = StrConv(CallbackFunctionName, vbUnicode) 'get the function ID of the callback function, based on its unicode-converted name, _ in order to ensure that it exists If GetFuncID(CurrentVBProject, UnicodeFunctionName, strFunctionID) = 0 Then 'if the function exists indeed ... 'get a pointer to the callback function based on the strFunctionID argument _ of the GetFuncID function If GetAddr(CurrentVBProject, strFunctionID, AddressOfFunction) = 0 Then _ AddrOf = AddressOfFunction 'if we've got the pointer pass it to the result of the function End If End Function #End If
Alain CROS
"JEROME BUNEL" a écrit dans le message de news: ctllnk$a3j$
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.
Merci
Bonjour
Private Sub CommandButton1_Click()
#If VBA6 Then
Call SetTimer(0, 0, 2000, AddressOf TimerProc)
#Else
Call SetTimer(0, 0, 2000, AddressOf("TimerProc"))
#End If
End Sub
Le Application.hwnd a été remplacé par 0 car ça n'existe pas sur XL97.
Le remplacer aussi dans Public Sub TimerProc
Coller ça dans un module.
Private Declare Function GetCurrentVbaProject& _
Lib "vba332" Alias "EbGetExecutingProj" _
(hProject&)
Private Declare Function GetFuncID& _
Lib "vba332" Alias "TipGetFunctionId" _
(ByVal hProject&, ByVal strFunctionName$, ByRef strFunctionID$)
Private Declare Function GetAddr& _
Lib "vba332" Alias "TipGetLpfnOfFunctionId" _
(ByVal hProject&, ByVal strFunctionID$, ByRef lpfnAddressOf&)
#If VBA6 Then
#Else
Public Function AddrOf&(CallbackFunctionName$)
'AddressOf operator replacement for Office97 VBA
'Authors: Ken Getz and Michael Kaplan
'declaration of local variables
Dim aResult&, CurrentVBProject&, strFunctionID$
Dim AddressOfFunction&, UnicodeFunctionName$
'if the current VBProjects exists...
If GetCurrentVbaProject(CurrentVBProject) = 0 Then Exit Function
'convert the name of the function to Unicode system
UnicodeFunctionName = StrConv(CallbackFunctionName, vbUnicode)
'get the function ID of the callback function, based on its unicode-converted name, _
in order to ensure that it exists
If GetFuncID(CurrentVBProject, UnicodeFunctionName, strFunctionID) = 0 Then
'if the function exists indeed ...
'get a pointer to the callback function based on the strFunctionID argument _
of the GetFuncID function
If GetAddr(CurrentVBProject, strFunctionID, AddressOfFunction) = 0 Then _
AddrOf = AddressOfFunction
'if we've got the pointer pass it to the result of the function
End If
End Function
#End If
Alain CROS
"JEROME BUNEL" <j.bunel@mondragon-assembly.com> a écrit dans le message de news: ctllnk$a3j$1@s1.news.oleane.net...
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne
marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas
en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et
XP.
Private Sub CommandButton1_Click() #If VBA6 Then Call SetTimer(0, 0, 2000, AddressOf TimerProc) #Else Call SetTimer(0, 0, 2000, AddressOf("TimerProc")) #End If End Sub
Le Application.hwnd a été remplacé par 0 car ça n'existe pas sur XL97. Le remplacer aussi dans Public Sub TimerProc
Coller ça dans un module.
Private Declare Function GetCurrentVbaProject& _ Lib "vba332" Alias "EbGetExecutingProj" _ (hProject&) Private Declare Function GetFuncID& _ Lib "vba332" Alias "TipGetFunctionId" _ (ByVal hProject&, ByVal strFunctionName$, ByRef strFunctionID$) Private Declare Function GetAddr& _ Lib "vba332" Alias "TipGetLpfnOfFunctionId" _ (ByVal hProject&, ByVal strFunctionID$, ByRef lpfnAddressOf&) #If VBA6 Then #Else Public Function AddrOf&(CallbackFunctionName$) 'AddressOf operator replacement for Office97 VBA 'Authors: Ken Getz and Michael Kaplan 'declaration of local variables Dim aResult&, CurrentVBProject&, strFunctionID$ Dim AddressOfFunction&, UnicodeFunctionName$ 'if the current VBProjects exists... If GetCurrentVbaProject(CurrentVBProject) = 0 Then Exit Function 'convert the name of the function to Unicode system UnicodeFunctionName = StrConv(CallbackFunctionName, vbUnicode) 'get the function ID of the callback function, based on its unicode-converted name, _ in order to ensure that it exists If GetFuncID(CurrentVBProject, UnicodeFunctionName, strFunctionID) = 0 Then 'if the function exists indeed ... 'get a pointer to the callback function based on the strFunctionID argument _ of the GetFuncID function If GetAddr(CurrentVBProject, strFunctionID, AddressOfFunction) = 0 Then _ AddrOf = AddressOfFunction 'if we've got the pointer pass it to the result of the function End If End Function #End If
Alain CROS
"JEROME BUNEL" a écrit dans le message de news: ctllnk$a3j$
Ca marche tres bien sous OFFICE 2000 ou > mais la fonction SetTimer ne marche pas sous office 97. Apparement la fonction "AdressOff" n'existe pas en VBA office 97.
Y'at"il une parade pour que mon fichier fonctionne sous Excel 97, 2000 et XP.