Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Uh Oh... :-(

I added this code to a workbook:

Private Sub Worksheet_Activate()
Application.CommandBars("Cell").Reset
Application.CommandBars("Row").Reset
Application.CommandBars(1).Reset
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=296) 'insert
from menu bar
Ctrl.Enabled = False
Next Ctrl
For Each Ctrl In Application.CommandBars.FindControls(ID:=478) ' delete from
menu bar
Ctrl.Enabled = False
Next Ctrl
Application.CommandBars("Row").FindControl(ID:=293 ).Enabled = False ' Delete
from Row
Application.CommandBars("Row").FindControl(ID:=296 ).Enabled = False ' Insert
From row
Application.CommandBars("Cell").FindControl(ID:=29 2).Enabled = False ' Insert
from cell
Application.CommandBars("Cell").FindControl(ID:=29 5).Enabled = False ' Delete
from cell
End Sub

Then changed it to get rid of the disallow Insert function so it looked like
this:

Private Sub Worksheet_Activate()
Application.CommandBars("Cell").Reset
Application.CommandBars("Row").Reset
Application.CommandBars(1).Reset
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=478) ' delete
from menu bar
Ctrl.Enabled = False
Next Ctrl
Application.CommandBars("Row").FindControl(ID:=293 ).Enabled = False '
Delete from Row
Application.CommandBars("Cell").FindControl(ID:=29 5).Enabled = False '
Delete from cell
End Sub

It didnt quite function as i wanted it to. So i deleted it. But now it wont
let me delte rows in any workbook i open. Except the first sheet allows
delete, but not insert. I dont know what i did, but i dont like it. Any
help is appreciated.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Uh Oh... :-(

Ok, i got most of my insert and delete back on existing workbooks. However,
my insert doesnt work on the first or last sheets in the workbook or on any
inserted sheets. Insert also doesnt work on any sheet of a new workbook. I
just reset CommandBars("Cell") and ("Row"). cant get the last part to work...


brownti wrote:
I added this code to a workbook:

Private Sub Worksheet_Activate()
Application.CommandBars("Cell").Reset
Application.CommandBars("Row").Reset
Application.CommandBars(1).Reset
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=296) 'insert
from menu bar
Ctrl.Enabled = False
Next Ctrl
For Each Ctrl In Application.CommandBars.FindControls(ID:=478) ' delete from
menu bar
Ctrl.Enabled = False
Next Ctrl
Application.CommandBars("Row").FindControl(ID:=29 3).Enabled = False ' Delete
from Row
Application.CommandBars("Row").FindControl(ID:=29 6).Enabled = False ' Insert
From row
Application.CommandBars("Cell").FindControl(ID:=2 92).Enabled = False ' Insert
from cell
Application.CommandBars("Cell").FindControl(ID:=2 95).Enabled = False ' Delete
from cell
End Sub

Then changed it to get rid of the disallow Insert function so it looked like
this:

Private Sub Worksheet_Activate()
Application.CommandBars("Cell").Reset
Application.CommandBars("Row").Reset
Application.CommandBars(1).Reset
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=478) ' delete
from menu bar
Ctrl.Enabled = False
Next Ctrl
Application.CommandBars("Row").FindControl(ID:=29 3).Enabled = False '
Delete from Row
Application.CommandBars("Cell").FindControl(ID:=2 95).Enabled = False '
Delete from cell
End Sub

It didnt quite function as i wanted it to. So i deleted it. But now it wont
let me delte rows in any workbook i open. Except the first sheet allows
delete, but not insert. I dont know what i did, but i dont like it. Any
help is appreciated.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1

Reply
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



All times are GMT +1. The time now is 07:56 PM.

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

About Us

"It's about Microsoft Excel"