+ Reply to Thread
Results 1 to 15 of 15

Error 50289 project is protected

  1. #1
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Error 50289 project is protected

    Hi,

    I have the below code for deleting all macro after my user finish saving the file as new workbook so they do not need anymore macro/VBA after. Problem is when i run to this macro it shows error 50289 project is protected. Can any one let me know how to fix this? it can be a code to unprotect the project just to enable the code?

    Thank you very much --



    Please Login or Register  to view this content.

  2. #2
    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: Error 50289 project is protected

    Hi, impresxy,

    have you tried saving the workbook in FileFormat *.xlsx (xlOpenXMLWorkbook) instead of deleting the project by code?

    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

  3. #3
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    Hi HaHoBe,

    I have the code before that to save the file as .xlsx but I also want to delete the code out because after it saved the code is still together with the file and the user can view it. I do not want them to see.

    thank you

  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: Error 50289 project is protected

    Hi, impresxy,

    maybe have a thought about the approach you have right now - to me it sounds as if you were better off by trying to use an AddIn with maybe some class programming as that would make the deleting of any code in the used workbooks obsolete. This is just my guess from what I read out from your post right now.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    Hi,

    Sorry but i am too new to use of AddIn. I have tested my file many times and sometimes there is not error ???
    May be I should figure it out more so i can explain better :P

  6. #6
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    I think my problem is I protect one of the sheet. when I unprotect this sheet, the code works fine.

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Error 50289 project is protected

    What about selecting all sheets and moving it to a new workbook?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  8. #8
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    Quote Originally Posted by :) Sixthsense :) View Post
    What about selecting all sheets and moving it to a new workbook?
    You mean instead of save as new file, we move them to new workbook?.. sounds good, do you have a code for that :P

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Error 50289 project is protected

    Oops don't MOVE it, select all sheets and copy it to new workbook

  10. #10
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Error 50289 project is protected

    Try like this....

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    it's also a great idea but as i have some other function like to save the file as a specific name. To copy, then it allow my user to save as another name which i do not want to allow this. but thank you anyway, i would use it with some other excel of mine. thank you so much Sixthsense
    and HaHoBe

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Error 50289 project is protected

    I am unable to get your point can you please explain it little bit more?

  13. #13
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Error 50289 project is protected

    I also want to delete the code out because after it saved the code is still together with the file and the user can view it.
    If you save a workbook in xlsx format it cannot contain code. All you need to do after saving in that format is to close the file and the code module will be gone.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  14. #14
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    Quote Originally Posted by macropod View Post
    If you save a workbook in xlsx format it cannot contain code. All you need to do after saving in that format is to close the file and the code module will be gone.
    Ahhhhh! got it! Thanks

  15. #15
    Forum Contributor
    Join Date
    02-01-2013
    Location
    Oslo
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Error 50289 project is protected

    Quote Originally Posted by :) Sixthsense :) View Post
    I am unable to get your point can you please explain it little bit more?
    Sorry my english is sick :P


    If I copy the sheets like in your code, workbook create another file and paste all sheets I have. Then this new workbook, it allows my user to save it wherever they want and whatever name they need. I do not want to allow them to do like that. anyway it's a very useful code, thank you for your help

+ Reply to Thread

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