View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Have "Freeze Pane" button track current state

Same events found at the workbook level are found at the app level but
applies to all workbooks.

Private Sub object_SheetActivate(ByVal Sh As Object)

object would be a reference to the application.

sh.parent would tell you which workbook.

there are many events to choose from. Look in the object browser at the
application object and then scroll through its methods, properties and
events.

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy


"Joe Sewell" wrote:

Interesting stuff. The Class_Initialize event may be the part I've been
missing; that's assuming, of course, that I can catch an event that
tells me the user has changed worksheets at the application level.

I'll take a look at it. Thanks, Tom!

Tom Ogilvy wrote:
http://www.cpearson.com/excel/AppEvent.htm

--
Regards,
Tom Ogilvy


"Joe Sewell" wrote:

I've added the Freeze Panes button to a toolbar, but I'm disappointed
that it doesn't show the current state. While it does toggle between
Freeze and Unfreeze, I'd like it to show whether the current worksheet
has frozen panes or not.

In Word I can use application events to detect window & document
changes; it can be slow, but it works. Excel, though, doesn't propagate
worksheet events up to the application, or at least it doesn't seem to.
If there were an App_WorksheetActivate event, I could use it to update
the status of my toolbar button(s). There doesn't seem to be such a
beast, though, in Excel 2003. (That's what my place of work has
"standardized" on, so upgrading is not an option.)

Is there a better way -- or *any* way, for that matter -- to get a
Freeze Panes button to show whether panes are frozen or not? (Yes, I
know I can look for the split bar, but that isn't as obvious as looking
at a toolbar button.)