If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Save Button
Is there any way you can make the save and save as buttons
in excel password protected or hidden for a specific spread sheet. I want to produce a template where users can imput their results and excel will calculate the results and let you print it off but not allow you to save it. |
#2
|
|||
|
|||
Save Button
Hi
you can put the following code in your workbook module Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) cancel=true End Sub -- Regards Frank Kabel Frankfurt, Germany wrote: Is there any way you can make the save and save as buttons in excel password protected or hidden for a specific spread sheet. I want to produce a template where users can imput their results and excel will calculate the results and let you print it off but not allow you to save it. |
#3
|
|||
|
|||
Save Button
Presumably you will want to save it.
This checks the network user name. Code: -------------------- '============================================= Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long '------------------------------------------ '- Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim UserName As String '- Network Login Name UserName = OSUserName If UserName "SmithF" Then MsgBox ("You cannot save this file") Cancel = True End If End Sub '- '----------------------------------- Function OSUserName() As String '----------------------------------- ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX 0) Then OSUserName = Left$(strUserName, lngLen - 1) Else OSUserName = vbNullString End If End Function '============================================== -------------------- --- Message posted from http://www.ExcelForum.com/ |
#4
|
|||
|
|||
Save Button
Hi
a different solution: - enter this code - in the VBA editor in the immediate window enter application.enableevents=false - save the file - enter the statement application.enableevents=True -- Regards Frank Kabel Frankfurt, Germany Presumably you will want to save it. This checks the network user name. Code: -------------------- '============================================= Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long '------------------------------------------ '- Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim UserName As String '- Network Login Name UserName = OSUserName If UserName "SmithF" Then MsgBox ("You cannot save this file") Cancel = True End If End Sub '- '----------------------------------- Function OSUserName() As String '----------------------------------- ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX 0) Then OSUserName = Left$(strUserName, lngLen - 1) Else OSUserName = vbNullString End If End Function '============================================== -------------------- --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disabling Save Button | Andrew | General Discussion | 1 | June 24th, 2004 02:53 PM |
Hide Menu Bar / Toolsbar / disable save button? | Param | Worksheet Functions | 0 | June 14th, 2004 05:45 PM |
Save in location button | Ravi Sandhu | Worksheet Functions | 2 | February 6th, 2004 10:28 PM |
Button Error - Save at location | Ravi Sandhu | Worksheet Functions | 2 | February 5th, 2004 10:17 PM |
Button - Save Location | Ravi Sandhu | Worksheet Functions | 0 | February 3rd, 2004 10:07 PM |