Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can a Macro on exel be set with a password? | Excel Worksheet Functions | |||
Password and Macro | Excel Discussion (Misc queries) | |||
how do i remove password from xls vba macro? | New Users to Excel | |||
Macro & Password | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions |