Friday, November 9, 2007

Disable Cut & Copy from Popup menu (Excel VBA/Word VBA)

Here is a simple way to disable the Cut & Copy in the Popup menu

Sub Disable_Buttons() Dim oC1 As CommandBarSet oC1 = Application.CommandBars("CELL") oC1.Controls("Cu&t").Enabled = FalseoC1.Controls("&Copy").Enabled = FalseEnd Sub
Other menu items can also be handled similarly
To disable the Insert & Delete in the Popup menu
oC1.Controls("&Insert...").Enabled = FalseoC1.Controls("&Delete...").Enabled = False

RowHeight property is used to get the Height

Returns the height of all the rows in the range specified, measured in points (point: Unit of measure referring to the height of a printed character. A point equals 1/72 of an inch, or approximately 1/28 of a centimeter.). Returns null if the rows in the specified range aren’t all the same height. Read/write Variant.You can use the Height property to return the total height of a range of cells.