VBA and Excel

From HaFrWiki42
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

  1. Close Microsoft Word (if it’s open)
  2. Right click the Start button > Click Explore
  3. In Windows Explorer, browse to c:\notes\framework\brokerbridge
  4. On the right hand pane, locate the file OfficeAddin.dll
  5. Right click on OfficeAddin.dll and rename to OfficeAddin.old
  6. Close Windows Explorer
  7. Start Microsoft Word and verify that the toolbar is gone!

See also

top

References

top