VBA - Excel setup

  • Thread starter Thread starter Morten
  • Start date Start date
M

Morten

I need to distribute a worksheet to several users. The work with this
particular workbook
will be enhanced dramatically if certain Excel-setup's are changed from
normal, for instance
by removing almost all toolbars. I am able to do this on opening this
workbook, but the
disadvantage is that I leave every user with a changed setup of their Excel.

Is it possible to initially in the VBA "take a snakshot" of the individual
users current setup,
then make the changes for working with this particular workbook, and then,
on closing this
workbook, "restore" the users settings as they were ?

Thanks a lot in advance !


Best regards,

Morten
 
Morten,

Try the two subs below; the first one stores the active
toolbars in a text file in c:\temp and hides them, and the
second one restores them.

Sub Hide_Toolbars()

'Check and store visible
Open "C:\temp\toolbars.txt" For Output As #1
For i = 1 To CommandBars.Count
If CommandBars(i).Visible = True Then Print #1, CommandBars
(i).Name
Next
Close #1

'Hide visible
Open "C:\temp\toolbars.txt" For Input As #1
Do Until EOF(1)
Line Input #1, tlbr
CommandBars(tlbr).Enabled = False
Loop
Close #1

End Sub
Sub Restore_Toolbars()

'Restore visible
Open "C:\temp\toolbars.txt" For Input As #1
Do Until EOF(1)
Line Input #1, tlbr
CommandBars(tlbr).Enabled = True
Loop
Close #1

End Sub

Nikos Y. (nyannaco at in dot gr)
 
Back
Top