View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_849_] Simon Lloyd[_849_] is offline
external usenet poster
 
Posts: 1
Default Autorun macros on opening


Hi, paste this in to the "This Workbook" module

Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then Cancel = True
End Sub

paste this in to an ordinary module:

Sub Auto_open()
On Error Resume Next
If ThisWorkbook.Name < "Test" Then
Application.Quit
End If
End Sub

If the workbook name is not EXACTLY like the wording "Test" then you
will not be able to open the workbook again, if you had the workbook
named "test" you still would not be able to open it, it MUST be exact!

Regards,
Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=569278