Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default using a password to in connection with macro protectio

Hello,

I added a password to the worksheet protection and then recieved a runtime
error related to this macro. Password is 1234, how can I insert the use of a
password into this macro?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/28/2004 by bmd
'

'
ActiveSheet.Unprotect
Range("D9:D82").Select
Selection.ClearContents
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

Thank You,
Brian

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default using a password to in connection with macro protectio

Hi
Sub Macro1()
ActiveSheet.Unprotect password:="1234"
Range("D9:D82").Select
Selection.ClearContents
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect password:="1234", DrawingObjects:=True,
Contents:=True, Scenarios:=True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany
"Brian" schrieb im Newsbeitrag
...
Hello,

I added a password to the worksheet protection and then recieved a runtime
error related to this macro. Password is 1234, how can I insert the use of
a
password into this macro?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/28/2004 by bmd
'

'
ActiveSheet.Unprotect
Range("D9:D82").Select
Selection.ClearContents
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

Thank You,
Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default using a password to in connection with macro protectio


Sub Macro1()
const PW as string="1234"

ActiveSheet.Unprotect PW
Range("D9:D82").Select
Selection.ClearContents
'Selection.Locked = False 'locked cells don't matter if the sheet
is not protected
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True;password:=PW
End Sub


Tim

"Brian" wrote in message
...
Hello,

I added a password to the worksheet protection and then recieved a
runtime
error related to this macro. Password is 1234, how can I insert the
use of a
password into this macro?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/28/2004 by bmd
'

'
ActiveSheet.Unprotect
Range("D9:D82").Select
Selection.ClearContents
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

Thank You,
Brian



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
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM
Help with connection macro? Kimberly Anne Excel Discussion (Misc queries) 0 May 9th 06 07:04 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
sql connection in macro tommy Excel Programming 1 August 31st 04 11:36 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 02:10 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"