+ Reply to Thread
Results 1 to 7 of 7

Please help password protecting the file having macro already installed

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Thumbs up Please help password protecting the file having macro already installed

    Dear Experts,

    Just now I have taken help from Holger for making the VB code for the attached spread sheet. Now, I need to protect both sheets in this file with possword protection.

    Can experts please help me? The file is attached. Macro already available is EVENT macro (fyi pls). I tried and failed.

    I have already unlocked the cells to be used by the users.

    Please help me. My sincere thanks for supporting to provide me this solution.

    Thanks and regards,
    gm2612

    OTD Monitoring parallel.xls
    Last edited by gm2612; 12-26-2013 at 07:45 AM. Reason: Attaching correct pread sheet

  2. #2
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Please help password protecting the file having macro already installed

    To protect the sheet, you can do by:
    1. Block all sheet by click on the corner (Between A and 1) top side (the sign + will appear before you click it).
    2. Choose Home tab, click on Format then click on 'Protect Sheet', enter your password to protect the sheet.

    I enclosed the file with password protection: 123

    Rgds,
    Iqbal
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Please help password protecting the file having macro already installed

    Hi Iqbal, thanks for the reply. But, I knew how to pretect the spread sheet with password protection under normal conditions. Now, I want to protect the sheet, and at the same time the macro shuld function without creating an error.

    VBA Code, I learned for automatic password protection and removal is below

    ActiveSheet.Unprotect Password:="123456"


    ActiveSheet.Protect Password:="123456"

    Now, the problem is that I do not know how and where in the existing macro these commands to be included. After completing this, the requirement is to -

    User should be able to enter the data only in the fields where the cells are unlocked - columns A to G in sheet OTD. Other areas should not be modifiable for users. Sheet1 is totally protected, where the user can only take print of it. (3rd page of sheet1 - cells are unlocked for data entry)

    Can you provide VBA code for completing this function please?

    Thanks and regards,
    gm2612

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Please help password protecting the file having macro already installed

    Hi, gm2612,

    instead of adjusting the portection in the course of the procedure allow VBA to be executed although the protection is set.

    In ThisWorkbook:
    Please Login or Register  to view this content.
    The setting is volatile (won´t get saved with the workbook) so it needs to be initialized on every opening of the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Please help password protecting the file having macro already installed

    Oh MY DEAR GURU Holger,

    Many thanks for the support. It is perfect. I am unable to understand what you have indicated as "The setting is volatile (won´t get saved with the workbook) so it needs to be initialized on every opening of the workbook" Can you please give what does this mean?

    THanks and regards,
    gm2612

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Please help password protecting the file having macro already installed

    Hi, gm2612,

    close the workbook, hold the Shift-Key and open it again. The Workbook_Open should not be executed and as that no macros would be allowed to run. So any change on Sheet OTD would lead to a run time error as you try to change locked cells on a protected sheet (Sheet1). Only when the procedure is run macros will be executed while you will get the message about protection if you try to change any locked cells.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Please help password protecting the file having macro already installed

    Thank you Soo much Holger.

    With Warm Regards,
    gm2612

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Password protecting 7-zip file
    By DanzaNZ in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2015, 03:48 AM
  2. Protecting and Reading password from text file
    By rkayasth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2010, 08:09 PM
  3. VBA for password protecting file
    By dhrestak in forum Word Programming / VBA / Macros
    Replies: 8
    Last Post: 07-12-2010, 10:12 AM
  4. Password Protecting cells in shared file
    By robmharrison in forum Excel General
    Replies: 2
    Last Post: 10-17-2008, 11:45 AM
  5. Password protecting certain worksheets in a file
    By Mike in forum Excel General
    Replies: 1
    Last Post: 03-29-2005, 11:06 PM

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