Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2
Default autorun a macro

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
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,501
Default autorun a macro

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

" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default autorun a macro

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


On Thu, 24 Jan 2008 06:09:33 -0800 (PST), wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to autoRun macro on WB open OlieH Excel Discussion (Misc queries) 8 January 11th 07 05:43 PM
Autorun Macro rexmann Excel Discussion (Misc queries) 2 August 2nd 06 02:03 PM
Autorun macro Kelly Excel Worksheet Functions 1 January 18th 06 04:03 PM
MACRO AUTORUN b52shut Excel Discussion (Misc queries) 1 December 15th 05 08:48 AM
Autorun macro by date Steve Excel Discussion (Misc queries) 2 May 3rd 05 09:09 AM


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"