VBA and Excel
Jump to navigation
Jump to search
Menu Bar missing
If your Menu-bar (File, Edit, View, Insert) is gone:
CommandBars("Worksheet Menu Bar").Enabled = True
Using the SendKeys
To my knowledge not much people know the trick in VBA to replay keyboard actions in VBA.
The application.SendKeys function makes this possible.
Easy to understand and easy to use.
See the Clear the immediate window below.
Key | Code |
---|---|
backspace | {backspace} or {bs} |
break | {break} |
Enter | ~ (tilde) |
Escape | {esc} |
F1 | {F1} |
Combine key with | precede key code |
Shift | + (plus sign) |
Ctrl | ~ (caret) |
Alt | % (percent sign) |
Clear the Immediate Window
- ' Clears the Excel-Immediate window by sending keystokes
- Public Sub clearImmediate()
- ' Goto the Immediate window, select All and delete (Clearing the windows)
- Application.SendKeys "^g ^a {DEL}"
- ' Return to Code Window
- Application.SendKeys "{F7}"
- End Sub ' clearImmediate
Quit Excel
' Quits the Excel application public sub quitExcel Application.SendKeys "%fx" End Sub
Toolbars Notes
After installing Lotus Notes 8 or greater including the Sametime component you will notice that a new toolbar called OfficeAddin has been added to your Microsoft Word application.
Solution
- Close Microsoft Word (if it’s open)
- Right click the Start button > Click Explore
- In Windows Explorer, browse to c:\notes\framework\brokerbridge
- On the right hand pane, locate the file OfficeAddin.dll
- Right click on OfficeAddin.dll and rename to OfficeAddin.old
- Close Windows Explorer
- Start Microsoft Word and verify that the toolbar is gone!