Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-07-2018, 10:24 PM
crazzyapple crazzyapple is offline Word VBA - Ignore MsgBox Windows 7 64bit Word VBA - Ignore MsgBox Office 2010
Novice
Word VBA - Ignore MsgBox
 
Join Date: Nov 2018
Posts: 2
crazzyapple is on a distinguished road
Default Word VBA - Ignore MsgBox

Hi;




I am using MS Word 2016 and I am trying to ignore a MsgBox, if the button is already deleted. This Sub is being called in another Sub. How the code is now, the message will always show. Any help will be greatly appreciated.



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

 varResponse = MsgBox("Button will be deleted.")
 
For Each obj In ActiveDocument.InlineShapes
 If varResponse = vbOK Then
    
  If obj.OLEFormat.Object.Name = "CommandButton1" Then
        obj.Delete
        
  End If
  End If
 Next
 
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA - Ignore MsgBox Problem with Msgbox in VBA Puzzled Programmer Excel Programming 6 09-06-2018 04:34 PM
msgbox when deleting cells Mikedk64 Excel Programming 11 07-13-2017 07:14 AM
What happend to Ignore once (spell check) in Word 2013? nick93 Word 2 07-05-2016 01:44 PM
How to make word ignore a specific shape when printing? ZAK Word 12 04-07-2014 03:14 PM
Word VBA - Ignore MsgBox Make MsgBox appear... Jamtart PowerPoint 3 09-01-2012 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft