|
ではブックを開いたときに、標準ツールバーにコンボボックスを挿入するように
したらどうでしょーか ? 以下のマクロを全て標準モジュールに入れ、いったん
ブックを閉じて再度開いてみて下さい。
Sub Auto_Open()
Dim WS As Worksheet
With Application.CommandBars("Standard") _
.Controls.Add(Type:=msoControlComboBox, Temporary:=True)
.AddItem "[シート選択]"
For Each WS In Worksheets
.AddItem WS.Name
Next
.Tag = "GetS"
.Priority = 1
.OnAction = "Ac_Sheet"
.DropDownLines = 10
.ListIndex = 1
End With
End Sub
Sub Auto_Close()
Dim Cmb As CommandBarControl
For Each Cmb In CommandBars("Standard").Controls
If Cmb.Tag = "GetS" Then Cmb.Delete: Exit For
Next
ThisWorkbook.Save
End Sub
Sub Ac_Sheet()
Dim Cmb As CommandBarControl
Dim MyS As String
For Each Cmb In CommandBars("Standard").Controls
If Cmb.Tag = "GetS" Then Exit For
Next
If Cmb Is Nothing Then Exit Sub
With Cmb
If .ListIndex < 2 Then GoTo ELine
MyS = .List(.ListIndex)
End With
With Worksheets(MyS)
If .Visible = False Then .Visible = True
.Activate
End With
Cmb.ListIndex = 1
ELine:
Set Cmb = Nothing
End Sub
|
|