Excel VBA按钮

时间:2013-09-27 16:59:58

标签: excel vba

在“ActiveSheet.Buttons”中,我得到按钮的大小,但不是我想要的文本,它只显示“按钮1”(显示的数字)。谁能告诉我如何在按钮中获取自定义文本?

Sub AT()
    Sheets("134B").Select
    Sheets("New Tab").Visible = True
    Sheets("New Tab").Select
    ActiveSheet.Buttons.Add(0.75, 0.75, 36, 28.5).Select
    ActiveSheet.Buttons.Add(37.5, 0.75, 17.25, 28.5).Select
    ActiveSheet.Buttons.Add(55.5, 0.75, 17.25, 28.5).Select
    ActiveSheet.Buttons.Add(73.5, 0.75, 36, 28.5).Select
    Sheets("New Tab").Copy Before:=Sheets(3)
    Sheets("New Tab").Select
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("New Tab (2)").Select
    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets("DB").Select
    Range("J23").Select
End Sub

1 个答案:

答案 0 :(得分:3)

ActiveSheet.Buttons.Add(0.75, 0.75, 36, 28.5).Caption= "Hi!"