[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Excel 2007 VBA prevent workbook use with macros disabled

Posted on 2012-03-23
6
Medium Priority
?
326 Views
Last Modified: 2012-06-18
Does anyone have any good ideas to stop use of a workbook when macros are disabled? I have some code in the Worksheet_Change and WorkSheet_SelectionChange that stops users inadvertently changing certain things.  I can't use protection for this some data is in a table and if the cells are protected the users can't sort and filter.

If they disable macros when the worbook opens they'll be able to change everything.  I thought of something like making the key sheets hidden and only unhiding them in Workbook_Open code, then hiding again when they close.  But if they start up, do some work, save, do some more work then close without saving changes, the sheets won't be hidden next time they open.

This does not need to be high security - it's just to stop accidental changes.  Any ideas?
0
Comment
Question by:andrewssd3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37756575
This is the usual method: http://www.vbaexpress.com/kb/getarticle.php?kb_id=379
Essentially, every time you save, the sheets get hidden, the save is done, then the sheets get shown again. That way, the last save was always done with hidden sheets.
0
 
LVL 17

Author Comment

by:andrewssd3
ID: 37756610
Thanks Rory I'll give that a try.  I do have some issues with Worksheet_BeforeSave in my corporate environment (see this question which you participated in), but hopefully I'll be able to get this work.  I'll report back.
0
 
LVL 17

Author Comment

by:andrewssd3
ID: 37757235
Unfortunately, as I thought, it's not possible to change the visibility of worksheets from a Worksheet_BeforeSave routine that is initiated from VBA code (see the previous question I referred to).

Any other approaches to this that don't involve BeforeSave? Otherwise I'll award the points to you Rory as your solution would work well in a 'normal' environment.  Mine is skewed by having a document managment system that intercepts all Save and Open calls (the approach works when I disble the doc management add-in, but this is not an option for normal use).
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37757347
Could you use the beforesave to schedule a routine with OnTime to do the hide, save and reshow? Might work...
0
 
LVL 17

Accepted Solution

by:
andrewssd3 earned 0 total points
ID: 37757587
Interesting idea - I'll give it a try...
0
 
LVL 17

Author Closing Comment

by:andrewssd3
ID: 38094558
Thanks for the input on this - it gave me some interesting avenues to try, but I could not get anything to work as I wanted.  In the end I just had to take the risk that some savvy user would be able to get round the macro issue.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question