[AccessD] Securing an Excel file programmatically from Access

Michael R Mattys michael.mattys at adelphia.net
Wed Apr 2 17:24:15 CST 2003


Dave, Group

Note that this will not work if the user disables macros
and there is nothing you or I can do about it without
messing with the user's computer:

Call this function in WorkBook Open

Public Function Lockdown()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim i As Integer
    i = 1
    For Each wb In Application.Workbooks
        Set wb = Application.Workbooks(i)
        For Each ws In wb.Worksheets
            With ws
                .EnableSelection = xlNoSelection
                .Protect Contents:=True, UserInterfaceOnly:=True
            End With
        Next
        i = i + 1
    Next
End Function

Michael R. Mattys
www.mattysconsulting.com
----- Original Message -----
From: "Bucher, Dave" <Dave.Bucher at state.mn.us>
To: <accessd at databaseadvisors.com>
Sent: Wednesday, April 02, 2003 5:26 PM
Subject: [AccessD] Securing an Excel file programmatically from Access


> Hi Everyone-
>
> Great praise to all you gurus who I've garnered much from in the past.
>
> Using Access97 and Excel97 ... I'm using DoCmd.OutputTo in Access to
output
> reports in .xls format and programatically send (twice a month) to a
client
> outside our network.  The problem is, our network is secure and client's
> isn't, so the folks enforcing the big bad fed privacy laws don't want to
let
> us send things with the push of a button!  Talk about trying to keep good
> gov't. down!
>
> Does anyone have code to secure the newly (OutputTo) created Excel
worksheet
> after it has been created prior to sending?
>
> Thanks much!
>
> Dave Bucher
> Information Technology Specialist
> Children's Research, Planning and Evaluation
>
> "Launch your boat, oh blessed youth, and flee at full speed from every
form
> of culture."--Epicurus
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list