【发布时间】:2018-04-25 00:03:28
【问题描述】:
我在隐藏我的自定义对话框框架时遇到问题。按下按钮后(他们调用了其他宏),我仍然有我的对话框框,如何隐藏它? 我正在使用“Dane_Makro”表。 我以前的版本运行良好(我没有添加 2 个额外的按钮,但我编辑了 vbYesNo 按钮 - 方案非常相似) 问候
'Public btnDlg As DialogSheet
Sub CallBots()
Dim btnDlg As DialogSheet
Dim ButtonDialog As String
ButtonDialog = "CustomButtons"
Dim klik As Boolean
klik = True
Dim oSHL As Object: Set oSHL = CreateObject("WScript.Shell")
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.DialogSheets(ButtonDialog).Delete
Err.Clear
Application.DisplayAlerts = True
Set btnDlg = ActiveWorkbook.DialogSheets.Add
With btnDlg
.Name = ButtonDialog
.Visible = xlSheetHidden
With .DialogFrame
.Height = 70
.Width = 300
.Caption = "Generowanie plików do BOTÓW"
End With
.Buttons("Button 2").Visible = False
.Buttons("Button 3").Visible = False
.Labels.Add 100, 50, 100, 100
.Labels(1).Caption = "Jak utowrzyć pliki wsadowe do botów?"
.Buttons.Add 220, 44, 130, 18 'Custom Button #1,index #3
With .Buttons(3)
.Caption = "Nowe pliki wsadowe"
.OnAction = "MakeBotsNew"
End With
.Buttons.Add 220, 64, 130, 18 'Custom Button #2,index #4
With .Buttons(4)
.Caption = "Konsolidacja plików wsadowych"
.OnAction = "MakeBotsConso"
End With
If .Show = False Then
oSHL.PopUP "Anulowanie procesu", 1, "Tworzenie plików", vbInformation
klik = False
End If
End With
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'On Error Resume Next
DialogSheets("CustomButtons").Delete
Err.Clear
Application.DisplayAlerts = True
Application.ScreenUpdating = True
btnDlg.Visible = xlSheetVeryHidden
'Application.ScreenUpdating = True
Application.EnableEvents = True
结束子
【问题讨论】: