Results 1 to 12 of 12

"Licence" an excel spreadsheet

Threaded View

  1. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: "Licence" an excel spreadsheet

    A simple thing would be to close the workbook if the windows logon doesn't match, something like this
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim sh As Worksheet
    Sheets("Welcome").Visible = xlSheetVisible
    For Each sh In Sheets
    sh.Visible = xlSheetVeryHidden
    Next sh
    End Sub
     
    Private Sub Workbook_Open()
    Dim sh As Worksheet
    If Environ("username") <> "Simon" Then
    Application.Quit
    Else
    For Each sh In Sheets
    sh.Visible = xlSheetVisible
    Next sh
    Sheets("Welcome").Visible = xlSheetHidden
    End If
    End Sub
    Don't forget to create a Welcome sheet, and the code goes in the ThisWorkbook module.
    Last edited by shg; 02-24-2009 at 09:49 PM. Reason: deleted spurious quote
    Not all forums are the same - seek and you shall find

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1