#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 504
Default Macro Password

I have a big long macro that has "Unprotect sheet" and "Protect sheet"
features in it. When i was setting it up though, i chose not to enter in a
password. I know want to add a password instead of leaving the field blank.
Is there a way i can do this without redoing the whole long macro again??
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro Password

Post the appropriate sections of your macro and someone will show you how to
modify it........

Vaya con Dios,
Chuck, CABGx3



"Kevin" wrote:

I have a big long macro that has "Unprotect sheet" and "Protect sheet"
features in it. When i was setting it up though, i chose not to enter in a
password. I know want to add a password instead of leaving the field blank.
Is there a way i can do this without redoing the whole long macro again??

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 504
Default Macro Password

I want to have the workbook protected to start with, but it will need to be
unprotected early on in the marcro for the macro to work. I will also need
for it to be protected again at the end.

Sub EMail()
'
' EmailCHECKORDER Macro
' Macro recorded
'
'Sub Mail_ActiveSheet_Outlook()
Calculate
Dim OutApp As Object
Dim OutMail As Object
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "yyyy-mm-dd")
Application.ScreenUpdating = False
Sheets("Emailed").Visible = True
Sheets("Emailed").Select
Sheets("Emailed").Copy
ActiveSheet.Unprotect
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("F2").Select
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Set wb = ActiveWorkbook
With wb
.SaveAs "ASDF New Accounts.xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "New Accounts Activity"
.Body = "When the file opens up, DO NOT UPDATE. Also, Please do
a 'Paste Special' and choose 'Values and Number Formats'"
.Attachments.Add wb.FullName
.Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Sheets("Emailed").Select
ActiveWindow.SelectedSheets.Visible = False
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

"CLR" wrote:

Post the appropriate sections of your macro and someone will show you how to
modify it........

Vaya con Dios,
Chuck, CABGx3



"Kevin" wrote:

I have a big long macro that has "Unprotect sheet" and "Protect sheet"
features in it. When i was setting it up though, i chose not to enter in a
password. I know want to add a password instead of leaving the field blank.
Is there a way i can do this without redoing the whole long macro again??

  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro Password

Try this.......Replace your similar lines with these.......

ActiveSheet.Unprotect Password:=PW

ActiveSheet.Protect Password:=PW

Vaya con Dios,
Chuck, CABGx3



"Kevin" wrote:

I want to have the workbook protected to start with, but it will need to be
unprotected early on in the marcro for the macro to work. I will also need
for it to be protected again at the end.

Sub EMail()
'
' EmailCHECKORDER Macro
' Macro recorded
'
'Sub Mail_ActiveSheet_Outlook()
Calculate
Dim OutApp As Object
Dim OutMail As Object
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "yyyy-mm-dd")
Application.ScreenUpdating = False
Sheets("Emailed").Visible = True
Sheets("Emailed").Select
Sheets("Emailed").Copy
ActiveSheet.Unprotect
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("F2").Select
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Set wb = ActiveWorkbook
With wb
.SaveAs "ASDF New Accounts.xls"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(o)
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "New Accounts Activity"
.Body = "When the file opens up, DO NOT UPDATE. Also, Please do
a 'Paste Special' and choose 'Values and Number Formats'"
.Attachments.Add wb.FullName
.Display
End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
Sheets("Emailed").Select
ActiveWindow.SelectedSheets.Visible = False
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

"CLR" wrote:

Post the appropriate sections of your macro and someone will show you how to
modify it........

Vaya con Dios,
Chuck, CABGx3



"Kevin" wrote:

I have a big long macro that has "Unprotect sheet" and "Protect sheet"
features in it. When i was setting it up though, i chose not to enter in a
password. I know want to add a password instead of leaving the field blank.
Is there a way i can do this without redoing the whole long macro again??

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
Can a Macro on exel be set with a password? Dave Excel Worksheet Functions 2 October 1st 07 09:11 PM
Password and Macro Wanna Learn Excel Discussion (Misc queries) 4 July 24th 07 03:20 PM
how do i remove password from xls vba macro? mahesh New Users to Excel 1 October 26th 06 10:22 AM
Macro & Password paulrm906 Excel Discussion (Misc queries) 2 March 4th 06 02:09 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


All times are GMT +1. The time now is 08:51 PM.

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"