Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reactivate VBE tools menu

Status
Not open for further replies.

Crundy

Programmer
Jul 20, 2001
305
GB
Someone at my work caught a macro virus (but they forgot the name of it) and has asked for my assitance. We removed it OK, but it has changed the font colour in the visual basic editor to white (to stop you from viewing the code) and disabled the visual basic editor's tools menu, stopping me from changing it back.

Does anyone know how to resolve this, apart from a complete reinstall of Word?
 
The following code allows you to re-enable your
VBE Tools menu in Excel - it should work in Word as
well.

1. In the VBE, choose Tools/References...and add
"Microsoft Visual Basic For Applications Extensibility"
library.

2. Insert a class module named VBECmdHandler, with the
following code:

Public WithEvents EvtHandler As VBIDE.CommandBarEvents

Private Sub EvtHandler_Click(ByVal CommandBarControl As _
Object, Handled As Boolean, CancelDefault As Boolean)

On Error Resume Next
Application.Run CommandBarControl.OnAction
Handled = True
CancelDefault = True

End


3. Insert a standard module, with the following code:

Dim MnuEvt As VBECmdHandler
Dim CmdItem As CommandBarControl
Dim EvtHandlers As New Collection

Sub ResetToolsMenu()

While EvtHandlers.Count > 0
EvtHandlers.Remove 1
Wend

With Application.VBE.CommandBars("Menu Bar").Controls("Tools")
.Enabled = True
.Reset
End With

End Sub



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top