Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would I use Spy++ to trap Excel sheet tab rename and delete events

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
I have tried to play around with Spy++ but have found it a little bit daunting. I would really like to figure out to use it to determine the messages Excel sends when a user renames or deletes a sheet tab by right clicking the sheet name in one of the tabs.

Can someone point me how to restrict things so I don't get so much data. As a starting point, I know that I can restrict the logging to just one hWnd. Any ideas and/or suggestions would be greatly appreciated! Thanks!

Have a great day!

j2consulting@yahoo.com
 
Quick clarification: are you really interested in how the tab gets renamed, or are you interested in Spy+
 
Actually both, I am working on some Excel apps and Deleting a sheet or renaming it are not events in Excel's object model. I'm hoping I can track down a Window's message that I can trap to handle that.

As to Spy+, my background is more VBA than VB but I really like digging into the details. As an old Dinosaur Jockey (I did COBOL for years) it's interesting that underneath the covers Windows is pretty much a messaging system just like the old mainframes were if you were ever given access to the system log.

Thanks for your response, I appreciate it!

Have a great day!

j2consulting@yahoo.com
 
SBendBuckeye, I remember we already discussed trapping of sheet-delete event in thread711-814517, a long time ago.

Trapping the rename event is much more difficult as no event is fired before or after this action.

Subclassing may work but chances are very small and even if it worked, it cannot be assured that, for example, the particular message trapping would work on all versions of Excel.

May be someone comes up with a better idea than subclassing.
 
Hello Hypetia,

You are correct. I am currently using the technique you described in the above thread for my code which needs to run after a sheet is deleted. This is just an area of ongoing interest for me, which is why I started a new thread. As always, thanks for your response!

Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top