![]() |
#1
|
|||
|
|||
![]()
Hi, I am working on a Word form template which will be progressively completed by multiple people. One person will start completing the form, then another will check and complete the next section, then finally a third will check and sign-off.
I would like the final user to not be able to save the document until one particular field is completed. I have found the following code which will not allow the form to be saved if that field is missing. Sub FileSave() Dim orng As Word.Range Dim ofld As FormFields Set orng = ActiveDocument.Range Set ofld = orng.FormFields For i = 1 To ofld.Count ofld(i).Select ' **** If ofld(i).Name = "PrimaryGroup" Then If ofld(i).Result = "Select..." Then MsgBox ofld(i).Name & " must be completed" Exit Sub End If End If '**** Next i ActiveDocument.Save End Sub The lines between the two '**** create the pop-up box, but I want this code to only run if a previous field "TriagedBy" has been completed. So, I have been thinking I need another If statement prior to the one above which says something along the lines of If TriagedBy is <> "" then to run the code above, otherwise, if TriagedBy = "" then continue to save the document. I am just not sure how it all fits together. Any help is much appreciated! |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Alternative for Multiple If Conditions? | zguan1 | Excel | 2 | 05-25-2017 09:12 AM |
![]() |
BlindMouse | Excel | 1 | 01-27-2016 12:19 AM |
Vba that shows an error message for certain conditions | Ellebb | Word VBA | 7 | 09-21-2015 11:24 PM |
![]() |
z941714 | Excel | 8 | 08-09-2015 04:12 PM |
![]() |
bundy5150 | Excel | 4 | 02-22-2011 10:00 AM |