Sub auto_open() ' Add_RightClickMenu 1 'auto_open に既に他のマクロが記述されている場合には、 'この1行だけを追加する ' End Sub Sub Add_RightClickMenu(num%) '標準メニューの上に追加 ' auto_openに追加するのを忘れずに! Dim i As Long Dim cstBar As CommandBar Dim wcb As CommandBar ' ' Application.CommandBars("cell").Reset ' Set cstBar = CommandBars("cell") ' cstBar_sub cstBar ' ' Application.CommandBars("row").Reset ' Set cstBar = CommandBars("row") ' cstBar_sub cstBar ' ' Application.CommandBars("column").Reset ' Set cstBar = CommandBars("column") ' cstBar_sub cstBar ' ' For i = 23 To 28 'Excel97の場合は 21 to 26 にして下さい 'Excel2003の場合は 29 to 34 にして下さい ' Application.CommandBars(i).Reset ' Set cstBar = CommandBars(i) ' cstBar_sub cstBar ' Next i = 0 For Each wcb In CommandBars i = i + 1 Select Case wcb.Name Case "cell", "Cell", "column", "Column", "row", "Row" Application.CommandBars(i).Reset Set cstBar = CommandBars(i) cstBar_sub cstBar ' Case Else ' DoEvents End Select Next End Sub Sub cstBar_sub(cstBar As CommandBar) With cstBar .Controls.Add Type:=msoControlButton, before:=1 .Controls(1).Caption = "ウィンドウの上下整列(&1)" .Controls(1).OnAction = "ウィンドウの上下整列" .Controls(1).FaceId = 298 .Controls(1).BeginGroup = True .Controls.Add Type:=msoControlButton, before:=2 .Controls(2).Caption = "アクティブシートの複数画面表示(&2)" .Controls(2).OnAction = "同一Sheetの複数画面表示" .Controls(2).FaceId = 585 .Controls.Add Type:=msoControlButton, before:=3 .Controls(3).Caption = "セル縦位置中央揃え(&3)" .Controls(3).OnAction = "セル縦位置中央揃え" .Controls(3).FaceId = 2062 .Controls(3).BeginGroup = True .Controls.Add Type:=msoControlButton, before:=4 .Controls(4).Caption = "セル縦位置上詰め(&4)" .Controls(4).OnAction = "セル縦位置上詰め" .Controls(4).FaceId = 2061 .Controls.Add Type:=msoControlButton, before:=5 .Controls(5).Caption = "列幅で折り返し(&5)" .Controls(5).OnAction = "列幅折り返し表示" .Controls(5).FaceId = 119 .Controls.Add Type:=msoControlButton, before:=6 .Controls(6).Caption = "全シートをHOMEポジションに(&6)" .Controls(6).OnAction = "To_Home" .Controls(6).FaceId = 1826 .Controls(6).BeginGroup = True .Controls.Add Type:=msoControlButton, before:=7 .Controls(7).Caption = "入力後のセル移動方向の変更(&7)" .Controls(7).OnAction = "セル移動方向切替" .Controls(7).FaceId = 133 .Controls.Add Type:=msoControlButton, before:=8 .Controls(8).Caption = "枠線の表示切替(&W)" .Controls(8).OnAction = "枠線表示切替え" .Controls(8).FaceId = 217 .Controls.Add Type:=msoControlButton, before:=9 .Controls(9).Caption = "行列番号の表示切替(&G)" .Controls(9).OnAction = "行列番号表示切替" .Controls(9).FaceId = 800 .Controls.Add Type:=msoControlButton, before:=10 .Controls(10).Caption = "A1形式R1C1形式の切替(&A)" .Controls(10).OnAction = "A1_R1C1" .Controls(10).FaceId = 503 .Controls.Add Type:=msoControlButton, before:=11 .Controls(11).Caption = "最近使用したファイルの一覧に追加(&E)" .Controls(11).OnAction = "Add_RecentFiles" .Controls(11).FaceId = 462 .Controls.Add Type:=msoControlButton, before:=12 .Controls(12).Caption = "全ての隠しシートを表示する(&Q)" .Controls(12).OnAction = "全シート表示" .Controls(12).FaceId = 2587 .Controls(12).BeginGroup = True .Controls.Add Type:=msoControlButton, before:=13 .Controls(13).Caption = "シートを確認しながら非表示にする(&R)" .Controls(13).OnAction = "シート隠蔽" .Controls(13).FaceId = 1641 .Controls.Add Type:=msoControlButton, before:=14 .Controls(14).BeginGroup = True End With ' End Sub Sub Reset_RightClickMenu() '右クリックメニューを初期化する場合はこのマクロを実行 2003/10/26 ' Dim i As Long For i = 23 To 28 Application.CommandBars(i).Reset Next ' End Sub