Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am writing a procedure to modify custom views. The workbook has a
long list of defined custom views, of which a user could be working in any one of them. In all likelihood, the changes that I would be making in my procedure would be to a view that is different than the one the user is currently working in. What I want to do is to capture the current custom view selection in a variable before I switch over to make my changes. That way, when my procedure terminates, I can switch the view back to the one that the user was working in without them even noticing that anything happened. Here is some untested code to explain more specifically: Sub ChangeCustomView() dim UsersView as Variant 'or another type if better set UsersView = 'this is where I am hung up - 'it should be the currently selected view ActiveWorkbook.CustomViews("Example").Show Call MakeChanges 'this subroutine would contain the specific modifications ActiveWorkbook.CustomViews(UsersView).Show ActiveWorkbook.Save End Sub Thanks for your help. Randy Eastland |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't believe there is a way to determine which Custom View is currently
shown. If I'm correct and you really can't determine the current Custom View, here's a trick which might work - untested. Use some spare rows somewhere (this should work for columns too). Each row in that range will represent a custom view. For each view, hide all of those rows except the one representing that view. You could then check which row is not hidden to find the current custom view. -- Rob van Gelder - http://www.vangelder.co.nz/excel "Randy" wrote in message om... I am writing a procedure to modify custom views. The workbook has a long list of defined custom views, of which a user could be working in any one of them. In all likelihood, the changes that I would be making in my procedure would be to a view that is different than the one the user is currently working in. What I want to do is to capture the current custom view selection in a variable before I switch over to make my changes. That way, when my procedure terminates, I can switch the view back to the one that the user was working in without them even noticing that anything happened. Here is some untested code to explain more specifically: Sub ChangeCustomView() dim UsersView as Variant 'or another type if better set UsersView = 'this is where I am hung up - 'it should be the currently selected view ActiveWorkbook.CustomViews("Example").Show Call MakeChanges 'this subroutine would contain the specific modifications ActiveWorkbook.CustomViews(UsersView).Show ActiveWorkbook.Save End Sub Thanks for your help. Randy Eastland |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How capture a date variable within a text cell? | Excel Discussion (Misc queries) | |||
Excel screen capture to capture cells and row and column headings | Excel Discussion (Misc queries) | |||
View Custom View with Sheet Protection | New Users to Excel | |||
How to view a custom view when the worksheet is protected? | Excel Worksheet Functions | |||
Missing "Custom View" entry from View menu | Excel Discussion (Misc queries) |