#1
|
|||
|
|||
Creating an "Approved" command button
Hi,
Would anyone be able to help me create a command button, where a user will click on and it will capture their windows login ID, date and time. It will display this information on the next line below the command button. I will appreciate any suggestions, I am at a complete lost. Thanks for your help. |
#2
|
||||
|
||||
What happens if the button is clicked more than once - including by different people?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Re: Creating an "Approved" command button
Ideally once the button is clicked, the form will be locked so no more changes can be made. Thanks.
|
#4
|
||||
|
||||
What kinds of controls, if any, does this form already use (i.e. formfields or content controls)?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
It is a form with form fields, what I am trying to achieve is, have the person complete the form, send it to their manager. The manager will review the form, click a button to approve the form. I was thinking if maybe word can capture their windows login as a signature. Then once form will be protected and no further changes can be made.
Thanks. |
#6
|
||||
|
||||
If you're using formfields, the document will already require Forms protection. In that case, you could use another text formfield for both the 'button' and the approval text.
For example, if you insert such a formfield and make its default text: Click Here to Approve you could attach an on-entry macro to it, coded as follows: Code:
Sub Approval() With ActiveDocument.FormFields("Text1") .Result = "Approved by " & Environ("Username") & " on " & Format(Now(), "DDDD, D MMMM YYYY @ hh:mm") .Enabled = False End With End Sub Do note that, as coded, only the approval formfield is locked.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thank you
Thank you very much for your help. This is exactly what I am looking for. I am not very good with Macros but I will try and figure it out.
Thanks again!! |
#8
|
||||
|
||||
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Thank you!!
Here is the code I used. I created a command button and used the code you recommended and it works beautifully. Thank you so much
Private Sub CommandButton1_Click() With ActiveDocument.FormFields("Text124") .Result = "Entered by " & Environ("Username") & " on " & Format(Now(), "DDDD, D MMMM YYYY @ hh:mm") .Enabled = False End With End Sub |
#10
|
||||
|
||||
Hi Donna,
While that certainly works the way you originally described, the approach I suggested obviates the need for a separate button. With my approach, the formfield becomes its own 'button'. Also be aware that ActiveX controls (the kind of control you used for the button) aren't supported on Macs, so your approach won't work if anyone with a Mac needs to use the form.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Thanks Chris,
Your suggestion does make a cleaner nicer looking form, but I was having trouble getting it to work with just the form field. All our users are on Windows, so we should not run into the issue for Mac users. Thanks again for your suggestion. Donna |
Tags |
approval, command button |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Having trouble with "Same as Previous" button for formatting headers | Roy Patience | Word | 3 | 05-24-2014 03:17 PM |
"Problem sending the command" on only one .xlsm file, Office XP/Win 7 64bit | skeith5 | Excel | 0 | 01-24-2012 02:24 PM |
Launch macro sub after hitting "create pdf" button in word | webharvest | Word VBA | 1 | 06-29-2011 04:56 PM |
"Back" Button - to behave like web browser (Not using last slide viewed). | emmiewoo | PowerPoint | 0 | 03-29-2011 06:54 AM |
"Send and Receive all Folders" button missing (but only with one account) | incognitus | Outlook | 0 | 10-12-2010 10:42 PM |