[]AAAAA
[]bbb
()b1
()b2
()b3
[]cccc
()c1
()c2
[]ddd
[]eee
[]BBBBB
()bb
()cc
()dd
()dd1
()dd2
[]ee
[]CCCC
...
當取到這個任務時,第一個想法是用 excel來做,可是長官說用excel會讓使用者覺得太簡單了,所以就要讓程式跑起來不像excel,第一步就是要改變excel的外觀,其中隱藏功能表及圖示是我想到的第一步,可是"Worksheet Menu Bar"(功能表)卻不能隱藏(執行時會有錯誤訊息),不過沒關係,不能隱藏整個功能表,卻能將內部的選項隱藏掉!
底下是我隱藏功能表及圖示的程式碼
Private Sub Workbook_Open()
'Call HidenMenu
'Call HidenLine(False)
Call clrCheckBox
End Sub
Sub HidenMenu()
Dim myCBar As CommandBar
Dim i As Long
With Worksheets(1)
i = 0
For Each myCBar In Application.CommandBars
If myCBar.Name = "Worksheet Menu Bar" Then
Dim myCCtl As CommandBarControl
For Each myCCtl In myCBar.Controls
myCCtl.Visible = False
Next
End If
If myCBar.Visible And myCBar.Name <> "Worksheet Menu Bar" Then
i = i + 1
.Cells(i, 27).Value = myCBar.Name
If myCBar.Enabled = False Then myCBar.Enabled = True
myCBar.Visible = False
End If
Next
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = True
End With
Set myCBar = Nothing '物件的釋放
End Sub
沒有留言:
張貼留言