Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


hi,
the following code starts with unprote the sheet and end with protected
sheet, now the problem is anybody can unprotect the sheet and do
something in the sheet . to avoid that i wanted to protect the sheet
with my own password say 'nowfal'. Is it possible to do that . if so
please help me in this matter .


Sub FCY2()
'
' FCY2 Macro
' Macro recorded 15/07/2004 by Musandam
'

'
ActiveSheet.Unprotect
Sheets("BILL").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("RECORD").Select
Range("A2:AH12000").Select
Selection.Copy
Range("A3").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False,
_
IconFileName:=False
Range("C2:H2").Select
Selection.ClearContents
Range("J2:L2").Select
Selection.ClearContents
Range("N2").Select
Selection.ClearContents
ActiveWindow.SmallScroll ToRight:=6
Range("O2:R2").Select
Selection.ClearContents
Range("T2:W2").Select
Selection.ClearContents
Range("Y2:AB2").Select
Selection.ClearContents
Range("AD2:AG2").Select
Selection.ClearContents
ActiveWindow.ScrollColumn = 1
Range("D2").Select
ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
ActiveWorkbook.Save
End Sub


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=386565

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


Sub ProtectSheet()
Dim Password
Password = "nowfal"
ActiveSheet.Protect Password, True, True, True
End Sub
Sub UnProtectSheet()
Password = "nowfal"
ActiveSheet.Unprotect Password
End Sub


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386565

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


HI,
Sorry its not working, i repeat and shorten the code

ActiveSheet.Unprotect

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
ActiveWorkbook.Save
End Sub

that unprotect with password say 'nowal'
at the end protect with same password.
eagerly waiting for the solution.
thanks in advance
with
regards
nowfa

--
nowfa
-----------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...fo&userid=1000
View this thread: http://www.excelforum.com/showthread.php?threadid=38656

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


Good evening Nowfal

Change this line:

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True

to this:

ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True,
Password:="nowfal"

Is that any better?

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=386565

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


Hi,
Mr.Dominic , sorry that is not working any other solution?, earlie
Late Mr.Frank kablin had given some idea , but i couldn't follow up
after sometime that great man left the world by tragic accident. Stil
i remember his contribution to this forum.
May God bless him.
regards
nowfa

--
nowfa
-----------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...fo&userid=1000
View this thread: http://www.excelforum.com/showthread.php?threadid=38656



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


Hi Nowfal

It does work. Copy this code in its entirity into a moduleof a blan
workbook. Run it, and then try to unprotect the sheet (Tools
Protection Unprotect Sheet. You will be prompted for a password
the password is "nowfal", without the quotes.

Sub ProtectSheet()
ActiveSheet.Protect DrawingObjects:=True, Scenarios:=True
Password:="nowfal"
End Sub

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=38656

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect with password


hi ,
sorry to say its not working.
Still i am short of my requirement. when i am firing the macro i am
getting the unprotect box , which i am not expecting , my intention is
no other user can unprotect the sheet without my permission, and in the
mean while they and myself can able to do the normal job.
with regards
nowfal


--
nowfal
------------------------------------------------------------------------
nowfal's Profile: http://www.excelforum.com/member.php...o&userid=10003
View this thread: http://www.excelforum.com/showthread...hreadid=386565

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
Password Protect ub Excel Worksheet Functions 1 January 14th 09 04:46 PM
Password Protect Kelly Excel Discussion (Misc queries) 2 January 18th 07 09:52 PM
Password Protect cubsfan Excel Discussion (Misc queries) 0 April 7th 06 03:34 PM
Password Protect Dedrie Excel Worksheet Functions 0 August 19th 05 07:03 PM
password protect frank Excel Discussion (Misc queries) 2 March 21st 05 05:55 PM


All times are GMT +1. The time now is 03:38 AM.

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

About Us

"It's about Microsoft Excel"