ToolBar Settings

EngineeringJeff

New Member
Joined
Jan 25, 2005
Messages
3
In my Auto Open Macro I am looking for the VBA code that would record the status of users setting found on Excels Menubar (Tools/Options/View). I am wanting to determine the users default setting of things such as statusbar visible ect so that upon termination of application possible to reset defaults.
Any Help!!!!!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
May this help you??

Code

<font face=Courier New><SPAN style="color:#00007F">Public</SPAN> OldSetMat(1 To 201, 1 To 2) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>

<SPAN style="color:#00007F">Sub</SPAN> StoreValues()
<SPAN style="color:#007F00">'</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> CBar <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> PointR  <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>

PointR = 1

OldSetMat(UBound(OldSetMat, 1), 1) = CommandBars.Count

<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> CBar <SPAN style="color:#00007F">In</SPAN> CommandBars
    OldSetMat(PointR, 1) = CBar.Name
    OldSetMat(PointR, 2) = <SPAN style="color:#00007F">CStr</SPAN>(CInt(CBar.Visible))
    PointR = PointR + 1
<SPAN style="color:#00007F">Next</SPAN>

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>

<SPAN style="color:#00007F">Sub</SPAN> ReStoreValues()
<SPAN style="color:#007F00">'</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> CBar <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> PointR  <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>

<SPAN style="color:#00007F">For</SPAN> PointR = 1 <SPAN style="color:#00007F">To</SPAN> OldSetMat(UBound(OldSetMat, 1), 1)
    CommandBars(OldSetMat(PointR, 1)).Visible = (OldSetMat(PointR, 2) <> "0")
<SPAN style="color:#00007F">Next</SPAN> PointR

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>


On place of Public Variable, You could also use two columns of a (hidden) worksheet to store values.

Post for feedback

Ciao :)
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top