Thread: [Solved] Word VBA - Ignore MsgBox
View Single Post
 
Old 11-07-2018, 11:11 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Move the message box to where you need to ask the question e.g.


Code:
Sub DeleteButton()
Dim obj As Object
Dim varResponse As Variant

    For Each obj In ActiveDocument.InlineShapes
        If obj.OLEFormat.Object.Name = "CommandButton1" Then
            varResponse = MsgBox("Button will be deleted.")
            If varResponse = vbOK Then obj.Delete
        End If
    Next
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote