Sub auto_open() ' Add_RightClickMenu_2 1 'auto_open に既に他のマクロが記述されている場合には、 'この1行だけを追加する ' End Sub Sub Add_RightClickMenu_2(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_2 cstBar ' ' Application.CommandBars("row").Reset ' Set cstBar = CommandBars("row") ' cstBar_sub_2 cstBar ' ' Application.CommandBars("column").Reset ' Set cstBar = CommandBars("column") ' cstBar_sub_2 cstBar ' ' For i = 23 To 28 'Excel97の場合は 21 to 26 にして下さい 'Excel2003の場合は 29 to 34 にして下さい ' Application.CommandBars(i).Reset ' Set cstBar = CommandBars(i) ' cstBar_sub_2 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_2 cstBar ' Case Else ' DoEvents End Select Next End Sub Sub cstBar_sub_2(cstBar As CommandBar) Dim i% i = cstBar.Controls.Count + 1 ' With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "選択したセルの情報(&L)" .Controls(i).OnAction = "CellsInformation" .Controls(i).FaceId = 343 .Controls(i).BeginGroup = True End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "ウィンドウの上下整列(&1)" .Controls(i).OnAction = "ウィンドウの上下整列" .Controls(i).FaceId = 298 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "アクティブシートの複数画面表示(&2)" .Controls(i).OnAction = "同一Sheetの複数画面表示" .Controls(i).FaceId = 585 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "セル縦位置中央揃え(&3)" .Controls(i).OnAction = "セル縦位置中央揃え" .Controls(i).FaceId = 2062 .Controls(i).BeginGroup = True End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "セル縦位置上詰め(&4)" .Controls(i).OnAction = "セル縦位置上詰め" .Controls(i).FaceId = 2061 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "列幅で折り返し(&5)" .Controls(i).OnAction = "列幅折り返し表示" .Controls(i).FaceId = 119 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "全シートをHOMEポジションに(&6)" .Controls(i).OnAction = "To_Home" .Controls(i).FaceId = 1826 .Controls(i).BeginGroup = True End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "入力後のセル移動方向の変更(&7)" .Controls(i).OnAction = "セル移動方向切替" .Controls(i).FaceId = 133 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "枠線の表示切替(&W)" .Controls(i).OnAction = "枠線表示切替え" .Controls(i).FaceId = 217 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "行列番号の表示切替(&G)" .Controls(i).OnAction = "行列番号表示切替" .Controls(i).FaceId = 800 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "A1形式R1C1形式の切替(&A)" .Controls(i).OnAction = "A1_R1C1" .Controls(i).FaceId = 503 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "最近使用したファイルの一覧に追加(&E)" .Controls(i).OnAction = "Add_RecentFiles" .Controls(i).FaceId = 462 End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "全ての隠しシートを表示する(&Q)" .Controls(i).OnAction = "全シート表示" .Controls(i).FaceId = 2587 .Controls(i).BeginGroup = True End With ' i = i + 1 With cstBar .Controls.Add Type:=msoControlButton .Controls(i).Caption = "シートを確認しながら非表示にする(&R)" .Controls(i).OnAction = "シート隠蔽" .Controls(i).FaceId = 1641 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