LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Problem in adding macro to ribbon through Add-in

Hi -

I am using the following simple code to protect and unprotect all
worksheets

Sub UnprotectAllSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="2016"
Next ws

End Sub


Sub protectAllSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="2016"
Next ws

End Sub


I have tested this in the workbook that it was created in and it is
working fine. I then save as Excel Add-in file so that I can use teh
function in a ribbon in other workbooks.

I load up a workbook and select the add in. I add the bottons to the
ribbon and assign the macro

Now the buttons appear on teh ribbon but have no function i.e. they do
nothing.

Under the developer bar I have checked the 'Macros' button. This shows
no macros listed - though I am not sure if it would as teh macro is
not assigned to the workbook so to speak, but to excel through the add-
in.

If I open VB editor, the codeis visable and all seems correct. However
if i 'run' it, again nothing happens.

The problem seems to be in linking the macro to the ribbon through the
add-in process. This is the first time I have tried thsi so any help
would be greatlyapprecated.

p.s. the workbook this was created in was the default excel sheet with
"sheet 1; sheet 2; sheet 3" as workbook tabs. The workbook I want this
to work on has 55 work sheets with a variety of names. I dont think
this would make a difference but I am stumped ......
Thanks all
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding CustomUI Ribbon code using macro to new generated file vikasmadaan25 Excel Programming 4 August 8th 11 04:45 PM
Excel 2007, adding a macro in an add-in to the ribbon Barb Reinhardt Excel Programming 5 March 13th 09 11:04 PM
Adding Items at runtime in the Ribbon ComboBox Markus Ohnmacht[_2_] Excel Programming 3 December 22nd 08 03:55 PM
Adding Menus to the Ribbon RyanH Excel Programming 10 October 14th 08 09:14 PM
Adding new sheet problem-Macro pikapika13[_2_] Excel Programming 2 March 28th 06 04:58 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"