Page 1 of 1

Excel Undo Method

Posted: 25 Jan 2020, 06:56
by miracle
Hello there,

i found autohotkey a little while ago and since i am really suprised what all is possible. I still didn't manage to work with classes, call backs or other advanced methods, but i am happy with what i have accomplished so far.

I am currently trying to automate Excel. And since i don't want to rely on Sending items i try to use COM. So far, so good :)

But now i have an dead-end. I want to implement a custom Undo method (https://docs.microsoft.com/en-us/office/vba/api/excel.application.onundo) but i don't find a way to call my method in my ahk file.

Anyone knows how to pass a pointer to a function which resides in my ahk file and not in a excel macro?

Thank you

Re: Excel Undo Method

Posted: 25 Jan 2020, 18:01
by flyingDman
Maybe you can be more specific and tell us the exact circumstance in which you would want to use this custom Undo. Give us an example.

Re: Excel Undo Method

Posted: 28 Jan 2020, 03:59
by Xeo786
actually when you make changes on sheet using COM its simply done and can only be undone if you preserve the previous state, and you can imagine how much detail you have to store per step, a excel cell has so many attrib / sub details like value formatting color borders, yah there is possibility but for more precision you have to write so more, and handling excel file with ahk com is enough precision if you know what are you doing,

following macro Jan Karel Pieterse is perfect example to acquire the ability to undo through code
https://jkp-ads.com/Articles/UndoWithVBA00.asp
following download link to excel file having ability to undo stuff done by vba Macro and you can check how limited are they
https://jkp-ads.com/Download.asp#UndoHandler

you need to write ahk classes I think! and I am not well familiar with AHK classes