View Single Post
 
Old 09-21-2014, 02:30 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Is there a reason for having the command button (presumably an ActiveX button) and not starting the userform automatically instead? The code you'd use for deleting the command button would be something like:
ThisDocument.CommandButton1.Delete
but you'll have problems deleting the command button while it's running a macro - which it continues to do until you unload your userform. Alternatively, have you considered using a MACROBUTTON field to start your userform instead of the command button? Such a field might be coded as:
{MACROBUTTON UserformLoad Click Here}
and
Drive a UserformLoad macro coded as:
Code:
Sub UserformLoad()
ActiveDocument.Fields(1).Result.Delete
UserForm1.Show
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote