Làm sao gắn Macro vào 1 nút trên Thanh Toolbars trong Excel

Liên hệ QC

qwertyuiopasdfghjkl

Thành viên bị đình chỉ hoạt động
Thành viên bị đình chỉ hoạt động
Tham gia
28/10/12
Bài viết
35
Được thích
0
Làm sao gắn Macro vào 1 nút trên Thanh Toolbars trong Excel ( Excel 2003, 2007 )
 
Lần chỉnh sửa cuối:
Làm sao gắn Macro vào 1 nút trên Thanh Toolbars trong Excel ( Excel 2003, 2007 )

Bạn copy hết code này cho vào 1 module rồi chạy thử
PHP:
Sub Menu_Maker()
      Call Menu_Remove
      Call MenuBars(7).Menus("Tools").MenuItems.Add("Test Macro", "Test")
End Sub
Sub Menu_Remove()
   Dim MenuItem As Object
   For Each MenuItem In MenuBars(7).Menus("Tools").MenuItems
       If MenuItem.Caption = "Test Macro" Then
           MenuItem.Delete
       End If
   Next
End Sub
Sub Test()
MsgBox "OK"
End Sub
 
Upvote 0
Bạn copy hết code này cho vào 1 module rồi chạy thử
PHP:
Sub Menu_Maker()
      Call Menu_Remove
      Call MenuBars(7).Menus("Tools").MenuItems.Add("Test Macro", "Test")
End Sub
Sub Menu_Remove()
   Dim MenuItem As Object
   For Each MenuItem In MenuBars(7).Menus("Tools").MenuItems
       If MenuItem.Caption = "Test Macro" Then
           MenuItem.Delete
       End If
   Next
End Sub
Sub Test()
MsgBox "OK"
End Sub

Có cách nào khác không ông anh. tôi thấy ông Ofice ổng hướng dẫn đâu cần Code gì đâu. tôi làm theo ổng mà không được . Anh xem hướng dẫn của ông Office nek

[h=1]How to: Assign a Macro to a Toolbar Button[/h]Visual Studio 2010

Other Versions
ImageSprite.png




3 out of 8 rated this helpful - Rate this topic



Visual Studio allows you to access a macro more easily by assigning it to a toolbar button.

[h=3]Assigning a Macro to a Toolbar Button[/h]
  1. Choose Customize from the Tools menu.
  2. Choose the Commands tab.
  3. Click the Toolbar radio button and select the target toolbar from the drop down list.
  4. Click the Add Command… button.
  5. Select Macros in the Categories list.
  6. Select the desired macro from the Commands list, and then click OK.
  7. Click Modify Selection and choose the appropriate commands to modify the appearance of the button, such as renaming it, assigning an image to it, and so on.

    http://msdn.microsoft.com/en-us/library/vstudio/3dy74ad1(v=vs.100).aspx


 
Upvote 0
Có cách nào khác không ông anh. tôi thấy ông Ofice ổng hướng dẫn đâu cần Code gì đâu. tôi làm theo ổng mà không được . Anh xem hướng dẫn của ông Office nek

How to: Assign a Macro to a Toolbar Button


Hướng dẫn đó dành cho Excel 2003 nha! Bạn đang áp dụng với Excel nào?
 
Upvote 0
Nhờ hướng dẫn hộ em cách tạo Menu cho Excel với. Em có nhiều modul nên phải làm nhiều nút rối màn hình quá. Em đang dùng Office 2010
Thanks bác!
 

File đính kèm

  • 2018-12-15 11-12-05-805.jpg
    2018-12-15 11-12-05-805.jpg
    513.7 KB · Đọc: 16
Lần chỉnh sửa cuối:
Upvote 0
Web KT
Back
Top Bottom