Most Recent Custom View

M

Michelle

When I add the 'Custom Views' drop-down to a toolbar, it displays the name
of the custom view most recently selected (through the menu)
So this information must be stored somewhere...

How can I access it in code?

I need to know the name of the custom view that has been selected by the
user?

I've been told it can't be done... but if the toolbar control can read it,
the informaion must be somewhere...

Any ideas?

Thanks

M
 
M

Mike H

Michelle,

I don't believe Excel strores the name of the last custom view that was used
so if a workbook contains multiple custom views then I think whoever told you
that you can't do this is correct.

I played with trying to trap the name using worksheet change event code but
changing the custom view doesn't appear to trigger an event.

You can get the names of the custom views

Dim cv As CustomView
For Each cv In ThisWorkbook.CustomViews
MsgBox cv.Name
Next

and you can set a custom view with code

ThisWorkbook.CustomViews("MyView").Show


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top