Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a simple sub that creates a file, emails the file, then deletes the
file, is it possible to protect the data in the new file in any way. The file is created from the original file where a range is selected and copied to the new file.Is it possible to protect the file so that whoever recieves the email cannot alter the info inside the attachment. Many Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi MSL
You can protect your worksheet This example send the selection in a new workbook and protect the sheet (password ron) Sub Mail_Selection() Dim source As Range Dim dest As Workbook Dim strdate As String Set source = Nothing On Error Resume Next Set source = Selection.SpecialCells(xlCellTypeVisible) On Error GoTo 0 If source Is Nothing Then MsgBox "The source is not a range or the sheet is protect, please correct and try again.", vbOKOnly Exit Sub End If If ActiveWindow.SelectedSheets.Count 1 Or _ Selection.Cells.Count = 1 Or _ Selection.Areas.Count 1 Then MsgBox "An Error occurred :" & vbNewLine & vbNewLine & _ "You have more than one sheet selected." & vbNewLine & _ "You only selected one cell." & vbNewLine & _ "You selected more than one area." & vbNewLine & vbNewLine & _ "Please correct and try again.", vbOKOnly Exit Sub End If Application.ScreenUpdating = False Set dest = Workbooks.Add(xlWBATWorksheet) source.Copy With dest.Sheets(1) .Cells(1).PasteSpecial Paste:=8 ' Paste:=8 will copy the column width in Excel 2000 and higher ' If you use Excel 97 use the other example .Cells(1).PasteSpecial xlPasteValues, , False, False .Cells(1).PasteSpecial xlPasteFormats, , False, False .Cells(1).Select .Protect "Ron" Application.CutCopyMode = False End With strdate = Format(Now, "dd-mm-yy h-mm-ss") With dest .SaveAs "Selection of " & ThisWorkbook.Name _ & " " & strdate & ".xls" .SendMail ", _ "This is the Subject line" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MSL" wrote in message ... I have a simple sub that creates a file, emails the file, then deletes the file, is it possible to protect the data in the new file in any way. The file is created from the original file where a range is selected and copied to the new file.Is it possible to protect the file so that whoever recieves the email cannot alter the info inside the attachment. Many Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use Tools, Protection to add sheet and workbook protection to make
it more difficult to make changes to an Excel file. This protection is pretty easy to defeat however. -- Jim "MSL" wrote in message ... |I have a simple sub that creates a file, emails the file, then deletes the | file, is it possible to protect the data in the new file in any way. The file | is created from the original file where a range is selected and copied to the | new file.Is it possible to protect the file so that whoever recieves the | email cannot alter the info inside the attachment. | Many Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protecting a file from Copy/Paste | Excel Discussion (Misc queries) | |||
Protecting an Excel file | Excel Discussion (Misc queries) | |||
protecting a file from deletion | Excel Discussion (Misc queries) | |||
Password protecting certain worksheets in a file | Excel Discussion (Misc queries) | |||
protecting a csv file | Excel Programming |