2022年8月11日 星期四

VBA:VISIBLE 屬性(SHEET、視窗、activex物件)

 VISIBLE,這個屬性再VB、VBA內相當多物件皆具備此一屬性,小編透過SHEET、視窗、RANGE 等物件做屬性說明。

 VISIBLE屬性,主要控制"可視"這物理特性(也就是隱藏與否可不可以看見)

EX:工作表2為例

Private Sub CommandButton1_Click()

    Sheets("工作表2").Visible = False '隱藏

End Sub


Private Sub CommandButton2_Click()

    Sheets("工作表2").Visible = True '顯示

End Sub

EX:視窗

Private Sub CommandButton1_Click()

    Application.Visible = False '隱藏

End Sub


Private Sub CommandButton2_Click()

    Application.Visible = True '顯示

End Sub

EX:activex物件,以命令按鈕為例

Private Sub CommandButton1_Click()

    CommandButton2.Visible = False '隱藏

End Sub

Private Sub CommandButton2_Click()

    CommandButton2.Visible = True '顯示

End Sub

沒有留言:

張貼留言

職場毒癌:你憑什麼以為你十年寒窗,抵得我三代從商

你憑什麼以為你十年寒窗,抵得我三代從商——這句話已經記不得是從哪裡看到的,可能是某部劇,也可能是某篇 FB 文章標題。 但最近,特別有感。 為什麼會有這種感觸? 職場上有個同事,一路慢慢升到課長,好歹也是管理職,雖說不上鐵飯碗,但在多數人眼裡也算穩定。 結果呢?輾轉換了兩個製造課...