#1
|
|||
|
|||
Word VBA: How to create a command button and trigger a function?
Code:
Private Sub CommandButton1_Click() Selection.Font.Color = wdColorRed End Sub How can I create a command button to do the things below? Code:
Selection.Font.Color = wdColorRed Selection.Font.Bold = wdToggle If Selection.Font.Underline = wdUnderlineNone Then Selection.Font.Underline = wdUnderlineSingle Else Selection.Font.Underline = wdUnderlineNone End If |
#2
|
||||
|
||||
Hi Tinfanide,
Try: Code:
Private Sub CommandButton1_Click() With Selection.Font .Color = wdColorRed .Bold = wdToggle If .Underline = wdUnderlineNone Then .Underline = wdUnderlineSingle Else .Underline = wdUnderlineNone End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes, I see how. Thanks.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Check Boxes and Command Buttons | Micky P | Word VBA | 0 | 10-27-2011 01:06 AM |
Word doc bug when closing from userform command button click macro | Joe Patrick | Word | 1 | 07-05-2011 08:53 PM |
Launch macro sub after hitting "create pdf" button in word | webharvest | Word VBA | 1 | 06-29-2011 04:56 PM |
Desperatly need help in trigger animations | quinn307 | PowerPoint | 0 | 03-27-2011 08:52 PM |
Command Button | cksm4 | Word VBA | 7 | 02-27-2011 08:47 PM |