ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protection (https://www.excelbanter.com/excel-programming/293609-protection.html)

Francisco[_2_]

Protection
 
Hi to all, do you know if any way to remove the Visual Basic tool bar from a file, I did in my file, but when the users open my file in their computer, the Visual Basic bar is there, How can I save the properties of the file and keep them in all computers

Thanks this place is a excelent!

Walt Weber

Protection
 
Hi Francisco,

I suspect that managing the visible property will serve
your purpose. The following is something I've used:

'******* CLOSE & RESTORE TOOLBARS **********
'ToolBar_List is a defined name, 1 cell range
'on worksheet #1
Sub CloseToolbars() 'CALL FROM AUTO_OPEN MACRO
Dim Oset As Integer
On Error GoTo TBCloseError
Oset = 1
ThisWorkbook.Worksheets(1). _
Range("ToolBar_List").CurrentRegion. _
Offset(1, 0).ClearContents
For Each t In CommandBars
If t.BuiltIn And t.Visible And _
t.Name < "Worksheet Menu Bar" Then
ThisWorkbook.Worksheets(1). _
Range("ToolBar_List"). _
Offset(Oset, 0).Value = t.Name
t.Visible = False
Oset = Oset + 1
End If
Next
Exit Sub
TBCloseError:
MsgBox "Close ToolBar Error"
End Sub

Sub RestoreToolbars() 'CALL FROM AUTO_CLOSE MACRO
Dim R As Object
On Error GoTo TBRestoreError
Set R = ThisWorkbook.Worksheets(1). _
Range("ToolBar_List"). _
CurrentRegion.Offset(1, 0)
For Each C In R.Resize(R.Rows.Count - 1, 1)
CommandBars(C.Value).Visible = True
Next
R.ClearContents
Set R = Nothing
Exit Sub
TBRestoreError:
Set R = Nothing
End Sub

Francisco, if you really want to lock out the user's
access to toolbars, consider using the enabled property
instead of the visible property.

Best Regards,
Walt

-----Original Message-----
Hi to all, do you know if any way to remove the Visual

Basic tool bar from a file, I did in my file, but when the
users open my file in their computer, the Visual Basic bar
is there, How can I save the properties of the file and
keep them in all computers?


Thanks this place is a excelent!
.



All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com