I'm trying to keep certain macros running when Word fires up or opens another document, but I want them removed from the list of macros the user can access (alt+f8).
I've tried adding 'private' instead of 'public', but this stops them running altogether for some reason.
Public Sub AutoExec()
DisplayStylesMenu
End Sub
Public Sub AutoNew()
DisplayStylesMenu
End Sub
Public Sub AutoOpen()
DisplayStylesMenu
End Sub
Public Sub DisplayStylesMenu()
' Opens the Formatting task pane (Style window)
Application.TaskPanes(wdTaskPaneFormatting).Visible = True
' Docks the window on the right
Application.CommandBars("Styles").Position = msoBarRight
End Sub
Currently, AutoExec, AutoNew and AutoOpen all appear in the publicly accessible macros list (because of the 'public' prefix), but when adding 'private' to any of them, they stop working and there's no error.
How can I keep the macros running on startup, opening a doc etc whilst hiding them from the macro list?
Private Sub AutoNew() MsgBox "test" Application.TaskPanes(wdTaskPaneFormatting).Visible = True Application.CommandBars("Styles").Position = msoBarRight End Sub
This didnt show the msgbox, so how can private subs can run automatically? – Timmah