Thread: Protection
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Walt Weber Walt Weber is offline
external usenet poster
 
Posts: 14
Default 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!
.