Why this macro not running in 2007

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
335
Office Version
  1. 2010
Platform
  1. Windows
Dear all,
This macro I was running in Excel2003 since many years

Code:
Sub unprotect_Click()
'
' unprotect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
      
    ActiveSheet.Unprotect
End Sub
Now what's wrong with Excel2007
This macro is in personal.xlsb

This macro is still running with no problem
Sub protect_Click()
'
' protect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
ActiveSheet.Protect

End Sub

Both the codes are there in personal.xlsb
but protect_click is working in any open workbook, but the unprotect_click is not working except that in personal workbook only
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
.
.

Could it be that the sheet you're trying to unprotect has a password?

If so, try something like:

ActiveSheet.Unprotect Password:="qwerty"
 
Upvote 0
There is no password as mentioned earlier and is reproduced below:

Code:
Sub protect_Click()
'
' protect_Click Macro
' Macro recorded 11-10-2003 by vipul
'
ActiveSheet.Protect

End Sub

Code:
Sub unprotect_Click()
 '
 ' unprotect_Click Macro
'Macro recorded  11-10-2003 by vipul
'            
ActiveSheet.Unprotect
End Sub

I want to run both codes in any open workbook and hence stored in personal.xlsb
So, my question is why Protect macro runs nicely and why Unprotect is not?
 
Last edited:
Upvote 0
Its really irritating for me. Its gives me error as under:
Cannot run the macro unprotect_click. The macro may not be available in this workbook or all macros may be disabled.
It was running nicely in excel2003.
 
Upvote 0
Its really irritating for me. Its gives me error as under:
Cannot run the macro unprotect_click. The macro may not be available in this workbook or all macros may be disabled.
It was running nicely in excel2003.

When you saved the XL2007 workbook, did you save it as an "Excel Macro-Enabled Workbook (*.xlsm)"?
 
Upvote 0
I dont save a work book. I just open new book, say book1
Total vlank workbook, not yet saved.
But my macro protect is rnning nicely. Problem is with unprotect only.
 
Upvote 0
please somebody help, before I uninstall 2007 and go back to old school of using Excel2003
 
Upvote 0
Surprisingly it runs when I try to run in personal.xlsb workbook from ribbon,
but it is not running in any other workbook, when personal.xlsb is in hidden mode
still, protect_click is running....
 
Upvote 0
I dont save a work book. I just open new book, say book1
Total vlank workbook, not yet saved.
But my macro protect is rnning nicely. Problem is with unprotect only.
Using Excel 2007 (& other versions) I have not been able to make either procedure fail, even under the circumstances stated here.
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top