Enter password to enable macros...

Ignition1

New Member
Joined
Feb 22, 2011
Messages
49
Hi

A workbook I have contains an "Update" VBA macro used by the administrator, this spreadsheet once "updated" is sent round to various people.

What I would to happen is that when the admin sends round the spreadsheet, the prompt that says "This workbook contains macros, enable/disable" etc does not appear. BUT when the admin clicks on the button linked to the Update macro - an input box appears asking for a password which enables macros and then runs the macro.

So I guess the macro would also have to disable macros at the end of it running so that it can be sent round.

Is this possible?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You could always have a userform or input box that is shown when the update button is pressed. Only the Admin would know the password and if the password is incorrect or not entered then the macro doesn't run.
 
Upvote 0
You can also test the login name of the user at the start of the update macro and exit immediately if it's not the administrator.
 
Upvote 0
Code:
Sub moveme()
    If InputBox("Please enter the Password", "Admin Password") = "password" Then
    
        'script   

    Else
        MsgBox ("Incorrect Password")
    End If
End Sub
 
Last edited:
Upvote 0
Thanks guys - I'll think about a workaround.

Basically I was trying to avoid the security warning pop up when it's sent to other people except when the workbook is being opened by the macro creator. But then the check to do that is itself a macro so it doesn't really work.

The only alternative is running the macro from a different workbook so that the end result is in the spreadsheet I want to send but the macro is in a workbook that I keep.
 
Upvote 0
You might also consider storing your macros in another book that only you and your admin have access to.

Have those macros do their work on a different book that doesn't contain macros.

Then distribute that book to your users.
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,445
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top