Why does Project act different when closing

H

Hans

Hi

I have make a vba-script in a template, there change the commandbars,
and when it close I like to go back to what the user had before. This
is also going fine, but there are troubles when I like to close it.
There are 2 crosses in the upper right corner and when I push the
cross, there are only close the template it is fine, but if I close
Project total, it isn't. I have check it, and I can see that all the
commandbars are coming shown as they shall, just before closing
(Msgbox closing), but when I start Project again, the settings are the
template. What does I miss to store the settings when closing Project?

Thanks
Hans

Code:

Sub RestoreCommandBars()
Dim CmdBar As Office.CommandBar

For Each CmdBar In Coll
If CmdBar.Index = 1 Then
Application.CommandBars("Menu Bar").Controls("File").Visible =
True
Application.CommandBars("Menu Bar").Controls("Edit").Visible =
True
Application.CommandBars("Menu Bar").Controls("View").Visible =
True
Application.CommandBars("Menu Bar").Controls("Insert").Visible
= True
Application.CommandBars("Menu Bar").Controls("Format").Visible
= True
Application.CommandBars("Menu
Bar").Controls("Project").Visible = True
Application.CommandBars("Menu Bar").Controls("Tools").Visible
= True
Application.CommandBars("Menu Bar").Controls("Window").Visible
= True
ElseIf CmdBar.Name = "Brugknapper" Then 'My personly commandbar
CmdBar.Visible = False
Else
CmdBar.Visible = True
End If
Next CmdBar

MsgBox ("Closing")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top