autorun a macro

  • Thread starter Thread starter adenbutter
  • Start date Start date
A

adenbutter

Hi Experts,
Can someone help me out. I have a spreadsheet with the code

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If Range("B1").Value = "" Then
MsgBox ("s.v.p. je naam invullen!")
End If
End Sub

in ThisWorkbook.

The spreadsheet must be filled in by various colleagues. On opening
the file a dialog about turning the macro's off or on, I know for sure
my colleagus will push the first button and will turn off the macro.
Is there a way to run the macro automatically, so without the dialog.
Altering the secutiry level is nog option, so I guess some additional
VBA will do the trick but I really don't know how.
Can someone help me out?? It would be much appreciated.
Regards,
Anja
 
Hi,

You can't use macros to change macro settings, to allow otherwise would be a
hackers dream. So, one approach is to hde all the sheets except a welcome
sheet and unhide the work sheets when macros are enabled. If the user doesn't
enable macros then they don't see the sheets they need and very quickly they
learn.

So you need a before close maco that hides all sheets except 1 and a
workbook open macro that unhides them. If your stuck on this then post back.

Mike
 
If your colleagues disable macros, then macros are disabled and no code will
run.

No way around it..............macro security is a safety feature and if there
was a way to get around it, then it wouldn't be very safe.

You can buy a digital signature and sign the workbook so the macro dialog
doesn't come up.

OR you could render the workbook useless by preventing users from accessing any
sheets unless they enable macros.


Gord Dibben MS Excel MVP
 
Back
Top