(Solved) – Vba question (Excel) – how can I return the address of a procedure to a variable?

(solved)-–-vba-question-(excel)-–-how-can-i-return-the-address-of-a-procedure-to-a-variable?

first at all sorry for my english, it’s not my native language.

I’d like to associate the address of a procedure that I created to a variable. Actually, I’m using a Windows Timer and in the Timer code, the function SetTimer is used this way :

    Sub StartTimer()
    TimerSeconds = 0.1 ' how often to "pop" the timer.
    TimerID = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressOf move2)
End Sub

I’d like to replace “AddressOf move2” with a public variable and to do so I need to obtain the address of the procedure but I don’t know how to do this.
I tried to write

variable = AddressOf move2

And it’s doesn’t work (variable type = long)

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *