VBE toolbar not ready for cutomizations

H

Hari Prasadh

Hi,

Some of my toolbars within VBE are missing. Like -- comment block, uncomment
block -- etc. They are neither on the main toolbar and nor within the Edit
menu.

So I right clicked on the toolbar and Customize - and dragged the needed
icons to my standard toolbar.

I work for some time and then close excel (I save the workbooks). I restart
Excel- Alt + F11--- Lo! the comment and uncomment block is again Missing!

And I have tried this many times, but somehow the VBE is adamant in not
getting *customized*.

Why is it happening? Please note I have customized toolbars in Normal excel
and they work perfectly fine. Any time I make changes to my normal excel
toolbar they would stay that way , next time I open Excel the changes would
have got applied. (I have the Excel10.xlb in my C:\Documents and
Settings\abc\Application Data\Microsoft\Excel).

Please guide me.

Thanks a lot,
Hari
India
 
K

keepITcool

Hari,

commandbars can have their Protection property set, thus disabling
customization.

in most cases you CAN set the protection to 0, but for some builtin bars
you cannot change it.

it's a good idea to reset the original protection after you've made
your changes.

dim lngProt as long
with commandbars(x)
lngprot = .protection
.protection=0
if protection = 0 then
'do your stuff
else
debug.print "cannot unprotect CB:" & .name
endif
.protection = lngprot
end with


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Hari Prasadh wrote :
 
H

Hari Prasadh

Hi KeepITcool,

Im sorry, I dont know how to proceed ahead.

I pasted your code on to my personal workbook as it is by including sub and
end sub.

I got an error for
a) -- with commandbars(x) -- variable not defined.. I included the following
statement -- Dim x As Integer
b) Then I got a compile error for -- if protection = 0 then -- Variable not
defined -- I changed it, by putting a period before protection
c) The I re-ran the whole thing. I got a run-time error '9' for subsript out
of range within line -- with commandbars(x) -- I changed Dim x As Integer
to Dim x As Long
d) Then i again got the same error. I changed it to -- Dim x As String -- I
got run time error '5' , invalid procedure call or argument.

1) What should I define -- x as--

2) What code would I have to write within -- 'do your stuff --

Please guide me.

Thanks a lot,
Hari
India
 
K

keepITcool

Hari,


I'm sorry, my code was NOT meant for cut & paste, but rather as an
example for you to study.

First:
Look in VBA help for Protection property on Commandbar object.




Second:

dim x as string
x="Standard"

compile error:
protection s/b .Protection


hth

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Hari Prasadh wrote :
 
H

Hari Prasadh

Hi keepITcool,

Thnx for the directions. Would try it out and post back in case of a
problem.

Thanks a lot,
Hari
India
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top