taigovinda
Well-known Member
- Joined
- Mar 28, 2007
- Messages
- 2,639
Hi,
I have a workbook-level double-click event that I put into a certain workbook awhile ago.
It checks if there is a record identifier in a certain format either in the target cell or in the current range, within the double-clicked row; if so it queries an SQL server to find backup documentation for that record identifier and opens the document(s) in internet explorer.
Turns out this procedure, which is working fine, would be good to have in other workbooks or just to have on all the time. So, I inserted it into an existing add-in that can be redistributed to all the folks that would use it. I did that using the App double-click event in the ThisWorkbook module of the add-in, as described here: http://www.cpearson.com/excel/appevent.aspx ...that is working fine too - but I don't like the way the two are interacting.
My question is... if people are double-clicking in workbooks that already have the event-driven macro coded into there, the event will fire twice - once at the workbook level and once at the application level from the add-in. Then it will try to find and open the backup documents twice. Given that the workbooks firing the event are already coded and distributed all over the place so I can't change that code, is there a way for my add-in to know that this particular double-click already caused a workbook-level event to trigger a macro? I could try to read the query command string from the active workbook and see if it contains the same record identifier that my add-in would be querying for, but wondered if there is a more universal way to do it.
Thanks for any help!
Tai
I have a workbook-level double-click event that I put into a certain workbook awhile ago.
It checks if there is a record identifier in a certain format either in the target cell or in the current range, within the double-clicked row; if so it queries an SQL server to find backup documentation for that record identifier and opens the document(s) in internet explorer.
Turns out this procedure, which is working fine, would be good to have in other workbooks or just to have on all the time. So, I inserted it into an existing add-in that can be redistributed to all the folks that would use it. I did that using the App double-click event in the ThisWorkbook module of the add-in, as described here: http://www.cpearson.com/excel/appevent.aspx ...that is working fine too - but I don't like the way the two are interacting.
My question is... if people are double-clicking in workbooks that already have the event-driven macro coded into there, the event will fire twice - once at the workbook level and once at the application level from the add-in. Then it will try to find and open the backup documents twice. Given that the workbooks firing the event are already coded and distributed all over the place so I can't change that code, is there a way for my add-in to know that this particular double-click already caused a workbook-level event to trigger a macro? I could try to read the query command string from the active workbook and see if it contains the same record identifier that my add-in would be querying for, but wondered if there is a more universal way to do it.
Thanks for any help!
Tai