Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2013, 11:35 PM
Registered User
 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Protecting a single macro button

Hi,

I set up a timesheet work book for a friend's business. There is a macro that puts all 26 payweeks of the year onto a new sheet as a new year roll over. this macro is on the sheet "set up"

the normal sheet which the day to day users are meant to put their times in is a seperate sheet, which has a print macro in the form of a button for each pay.

The problem is that we dont want the everyday employees using the setup sheet as this has the newyear macro and other inportant links to the work book in it.

We have protected this sheet and locked, hidden and everything that you can think of so the users cant do anything in the "setup".

But guess what....

They can still view the sheet and click the new year button which allows them to roll over the new year. even though the sheet is protected they can run the macro from the button anyway!

I cant diable macro's because then they cant use the print macro on their pay days.

how can i protect the setup sheet so that they cant view it without a password.

or is their another way to tackle this problem, keep in mind that i want the button for the new year still to exist so that the payroll officer can still use it.

Thanks
 
Old December 6th, 2013, 08:55 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

The solution is present in the problem statement.itself

Just do a check in your macro with the same business logic you had specified. You can get the logged in user using Win API methods and check for dates as well

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Handle more than one submit button in single form? ctatvasoft PHP How-To 0 November 16th, 2009 07:25 AM
Multiple event handlers for a single button monuindia2002 ASP.NET 1.0 and 1.1 Professional 1 October 16th, 2005 11:22 PM
Call macro in Add-in from a toolbar button??? Chavo Excel VBA 1 May 3rd, 2005 01:55 PM
Option Button & Macro jvanhalderen Excel VBA 2 November 28th, 2004 04:09 PM
email an excelsheet using a macro behind a button Haroldd Excel VBA 2 January 8th, 2004 04:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.