+ Reply to Thread
Results 1 to 4 of 4

Need help to enhance disabling of various features on this code

  1. #1
    Forum Contributor
    Join Date
    05-03-2013
    Location
    Costa Rica
    MS-Off Ver
    MS Excel 365
    Posts
    141

    Need help to enhance disabling of various features on this code

    Hi there!

    I am using the code below to disable both print, save, and save as features on my Excel 2003 files. However, I realize that users may get a chance to disable macros when opening my files, which really sucks. So, I’d like to find a way to also use VBA to hinder users from doing that. Is that possible? Having a message box that could alert them about this would be even nicer.

    Now that I think it thorough, I also need a code to disable the copy feature so that users might not get a chance to get partial or total copies of my files. This is mandatory without exception. Otherwise, the codes below will not serve its purpose.

    And just to let you know: My idea is also to use a VBAProject Password to hinder users from disabling codes, but this is easy to do. I just need somebody’s help to be able to accomplish all what I mentioned before:

    ============================
    Private Sub Workbook_Open()
    ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
    End Sub

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If SaveAsUI = True Then Cancel = True
    End Sub

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Cancel = True
    MsgBox "Sorry! You're not allowed to print this file!"
    End Sub

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to enhance disabling of various features on this code

    This is one of the more common methods
    http://danielklann.com/excel/force_m...be_enabled.htm

    It's not completely bulletproof but it is (as far as I'm aware) what most people use.

  3. #3
    Forum Contributor
    Join Date
    05-03-2013
    Location
    Costa Rica
    MS-Off Ver
    MS Excel 365
    Posts
    141

    Re: Need help to enhance disabling of various features on this code

    Thanks for replying, yudlugar. Though, I don't understand anything I find on that webpage. It's all in Chinese or any Asian Pacific language. See file attached.
    Attached Images Attached Images

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to enhance disabling of various features on this code

    Ah ok, not sure what happens there. Basically you get a single sheet that just says "please enable macros" and you write a workbook_beforesave macro to set all the other sheets to very hidden. Then you put in a workbook_open macro to unhide them all when the sheet is opened.

    If you google "excel vba force user to enable macros" or something of that ilk there are many guides with in depth details on the code required.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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