Disable the ability to delete columns from a table in word Word XP/2000 !!!!!HELP!!!!!

S

shawn

Hi all,
I use this forum extensively but this is the first time I am posting
so I hope it goes well!
I have a document management application and for this Word is required
to track all changes. However, Word does not track changes when you
delete an entire column from a table, and in fact gives you a message
box saying such. So I would like to disable the option to delete a
column all together. I have a template which has several funcitons and
subs, so in it I have a sub to set menu options when a document is
opened. So far I am able to disable the option on the main
menu with the following simple code:

Sub SetMenuOptions(ByRef aBoolSet As Boolean)
Dim curMenu, lControl, lItem, lOptions
Dim lSelection

'new requirement for XP - Remove the delete cell menu option
Set curMenu = CommandBars.ActiveMenuBar.Controls
Set lControl = curMenu("Table")
Set lItem = lControl.Controls("Delete")
For Each lOptions In lItem.Controls
If lOptions.ID = 292 Or lOptions.ID = 294 Then
lOptions.Visible = aBoolSet
End If
Next


End Sub

THE PROBLEM:
The option to delete a column is available when you select an entire
column and right click. How can I access that right click menu
programmatically? I'm pretty good with word programming and VBA in
general but I haven't been able to figure this out for a long time.
Anyone have a similar experience or any thoughts???
BTW: this is Word XP but the same would hold true in 2000.

Thanks!
Shawn
 
D

Doug Robbins

Create a macro

TableDeleteColumn()
MsgBox "No you don't"
End Sub

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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