omnibuster
05-04-2010, 01:27 PM
Hi.
If i open wbk, code does not affect immediately?
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
If ActiveSheet.Name = ("Data") Or ActiveSheet.Name = ("Query") Or ActiveSheet.Name = ("Sheet1") Then
Outdel
Else
Indel
End If
Next ws
Application.ScreenUpdating = True
End Sub
Sub Outdel()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=847)
Ctrl.Enabled = False
Next Ctrl
End Sub
Sub Indel()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=847)
Ctrl.Enabled = True
Next Ctrl
End Sub
If i open wbk, code does not affect immediately?
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
If ActiveSheet.Name = ("Data") Or ActiveSheet.Name = ("Query") Or ActiveSheet.Name = ("Sheet1") Then
Outdel
Else
Indel
End If
Next ws
Application.ScreenUpdating = True
End Sub
Sub Outdel()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=847)
Ctrl.Enabled = False
Next Ctrl
End Sub
Sub Indel()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=847)
Ctrl.Enabled = True
Next Ctrl
End Sub