[AccessD] Access To Excel - Best Practices For Protecting For mulas

Hale, Jim Jim.Hale at FleetPride.com
Fri Apr 14 09:51:10 CDT 2006


Larry,
Here is a code snippet I use:
With appexcel
 If strPW <> "none" Then 'set password
     For i = 1 To .Sheets.Count
        .Worksheets(i).Protect Password:=strPW
    Next i
        .Sheets("instruc").Unprotect Password:=strPW
        .Sheets("assumptions").Unprotect Password:=strPW
    End If
end with
 This will lock all cells that have the lock flag checked. To unlock cells
so that they can be used for input go <format><cells><protection>uncheck
<locked>. BTW the xlSheetVeryHidden constant can be used to hide sheets so
they cannot be seen  by the user at all. I use this to hide sheets where
I've placed special formulas, indexes, Password, etc that the user never
needs to see. HTH
Jim Hale

-----Original Message-----
From: Lawrence Mrazek [mailto:lmrazek at lcm-res.com]
Sent: Thursday, April 13, 2006 4:38 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Access To Excel - Best Practices For Protecting
Formulas


 Hi:

Hopefully this will be my last message on this subject (much thanks to Jim
Hale and the rest of the list for helping me with my Access to Excel VBA
woes). I'm building a pretty complex workbook from Access (multiple
worksheets, using named ranges in formulas), and everything is working fine,
data is coming down from access, my template correctly formats the results
(conditional formatting even works!) and I'm pretty happy. 

Since we're getting ready to roll this out to the sales dept, I'm wondering
what is the best way to protect all of my formulas from someone
inadvertantly deleting or altering them? While I have some of the cells on
the workbook that can be edited, the majority are formulas that need to be
protected. Can I do this sort of selective protection in VBA?

Thanks in advance for any hints.

Larry Mrazek
LCM Research, Inc.
www.lcm-res.com
lmrazek at lcm-res.com
ph. 314.432.5886
fx. 314.432.3304


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list