![]() |
|
|
Thread Tools | Display Modes |
#2
|
||||
|
||||
![]()
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] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Command button to show userform suddenly stopped working | jpb103 | Word VBA | 0 | 05-22-2014 06:05 AM |
![]() |
johndough | Excel Programming | 3 | 05-11-2014 11:44 AM |
![]() |
BoringDavid | Word VBA | 5 | 05-09-2014 09:08 AM |
Userform Code not quite right - help please | vbanovice | Word VBA | 1 | 09-29-2013 09:20 PM |
Word doc bug when closing from userform command button click macro | Joe Patrick | Word | 1 | 07-05-2011 08:53 PM |