thanhnhanubnd
Thành viên hoạt động
- Tham gia
- 12/9/08
- Bài viết
- 180
- Được thích
- 29
- Nghề nghiệp
- Xay dung
Mình có "chôm" 1 đoạn code, đã làm được nhưng chưa tạo được Divirer, FadeID cho menu :
PHP:
Sub Auto_Open()
On Error Resume Next
lenh Delete CommandBar
'khoi tao menu Du lieu'
Set oldMbar = CommandBars.ActiveMenuBar
Set myMenuBar = CommandBars.Add(Name:="Quan ly du lieu menu" _
, Position:=msoBarTop, MenuBar:=False, Temporary:=True)
With myMenuBar
.Visible = True: .Protection = msoBarNoMove
End With
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
newMenu.Caption = "&Quan ly du lieu"
'tao Menu tilte Chon thu muc'
Set Ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl1.FaceId = 66
Ctrl1.Caption = "Chon thu muc..."
Ctrl1.TooltipText = "Chon thu muc..."
Ctrl1.Style = msoButtonCaption
'chay ung dung bang menu cap nhat van ban'
Ctrl1.OnAction = "chon_thumuc"
'tao Menu tilte Cap nhat du lieu'
Set Ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl2.FaceId = 66
Ctrl2.Caption = "Cap nhat van ban"
Ctrl2.TooltipText = "Cap nhat van ban"
Ctrl2.Style = msoButtonCaption
'chay ung dung bang menu cap nhat van ban'
Ctrl2.OnAction = "capnhatvanban"
'tao Menu tilte Sap xep tang dan'
Set Ctrl3 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl3.FaceId = 66
Ctrl3.Caption = "&Sap xep tang dan"
Ctrl3.TooltipText = "Sap xep tang dan"
Ctrl3.Style = msoButtonCaption
'chay ung dung bang menu cap nhat van ban'
Ctrl3.OnAction = "Sap_tangdan"
Set Ctrl4 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl4.Caption = "Sap xep giam dan"
Ctrl4.TooltipText = "Sap xep giam dan"
Ctrl4.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Ctrl4.OnAction = "capnhatvanban"
Set Ctrl5 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl5.Caption = "&Luu van ban"
Ctrl5.TooltipText = "Luu van ban..."
Ctrl5.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Set Ctrl6 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl6.Caption = "&In van ban"
Ctrl6.TooltipText = "In van ban"
Ctrl6.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Ctrl6.OnAction = "Print"
Set Ctrl7 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl7.Caption = "&Tao van ban Word moi..."
Ctrl7.TooltipText = "Tao van ban moi"
Ctrl7.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Ctrl7.OnAction = "Tao_word"
Set Ctrl8 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl8.Caption = "Loai van ban khac..."
Ctrl8.TooltipText = "Loai Van ban khac"
Ctrl8.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Ctrl8.OnAction = "lienket"
Set Ctrl9 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Divider = True
Ctrl9.Caption = "Thoat khoi chuong trinh"
Ctrl9.TooltipText = "Exit"
Ctrl9.Style = msoButtonCaption
'chay ung dung bang menu Tro ve trang chu'
Ctrl9.OnAction = "nghi"
With myMenuBar
.Visible = True: .Protection = msoBarNoMove
End With
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
newMenu.Caption = "&Tim kiem van ban"
'tao Menu tilte Tim kiem van ban'
Set Ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl1.FaceId = 23
Ctrl1.Caption = "Tim theo ngay tao"
Ctrl1.TooltipText = "Tim theo ngay tao"
Ctrl1.Style = msoButtonCaption
'chay ung dung bang menu Tim theo ngay tao'
Ctrl1.OnAction = "tim_ngay"
Set Ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl2.Divider = "TRUE"
Ctrl2.Caption = "Tim theo thang tao"
Ctrl2.TooltipText = "Tim theo thang tao"
Ctrl2.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl2.OnAction = "tim_thang"
Set Ctrl3 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl3.Divider = "TRUE"
Ctrl3.Caption = "Tim theo ngay thang nam"
Ctrl3.TooltipText = "Tim theo ngay thang nam"
Ctrl3.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl3.OnAction = "tim_ngay_thang_nam"
Set Ctrl4 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl4.FaceId = 66
Ctrl4.Caption = "Tim ten van ban"
Ctrl4.TooltipText = "Tim ten van ban"
Ctrl4.Style = msoButtonCaption
'chay ung dung bang menu Tim theo ngay tao'
Ctrl4.OnAction = "tim_noidung"
Divider = True
Set Ctrl5 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl5.Divider = True
Ctrl5.Caption = "Tim nguoi tham muu"
Ctrl5.TooltipText = "Tim nguoi tham muu"
Ctrl5.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl5.OnAction = "tim_thammuu"
Set Ctrl6 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl6.Divider = True
Ctrl6.Caption = "Tim nguoi lanh dao ky"
Ctrl6.TooltipText = "Tim nguoi lanh dao ky"
Ctrl6.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl6.OnAction = "tim_nguoiky"
Set Ctrl7 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl7.Divider = True
Ctrl7.Caption = "Tim so van ban"
Ctrl7.TooltipText = "Tim so van ban"
Ctrl7.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl7.OnAction = "tim_so"
Set Ctrl8 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl8.Divider = True
Ctrl8.Caption = "Hien thi tac ca van ban"
Ctrl8.TooltipText = "Hien thi tat ca van ban"
Ctrl8.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl8.OnAction = "khong_tim"
With myMenuBar
.Visible = True: .Protection = msoBarNoMove
End With
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
newMenu.Caption = "Thong tin chuong trinh"
'tao Menu tilte Tim kiem theo noi dung'
Set Ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=3)
Ctrl1.FaceId = 66
Ctrl1.Caption = "Cach su dung chuong trinh"
Ctrl1.TooltipText = "&Cach su dung"
Ctrl1.Style = msoButtonCaption
'chay ung dung bang menu Tim theo ngay tao'
Ctrl1.OnAction = "su_dung"
Set Ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
Ctrl2.Divider = True
Ctrl2.Caption = "Thong tin..."
Ctrl2.TooltipText = "Thong tin..."
Ctrl2.Style = msoButtonCaption
'chay ung dung bang menu Tim theo thang tao'
Ctrl2.OnAction = "thong_tin"
With myMenuBar
.Visible = True: .Protection = msoBarNoMove
End With
End Sub