Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-20-2017, 10:47 PM
Cath2017 Cath2017 is offline Code for multiple conditions to be met to display a pop up message Windows 7 32bit Code for multiple conditions to be met to display a pop up message Office 2010 32bit
Novice
Code for multiple conditions to be met to display a pop up message
 
Join Date: Jul 2017
Posts: 3
Cath2017 is on a distinguished road
Default Code for multiple conditions to be met to display a pop up message

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!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative for Multiple If Conditions? zguan1 Excel 2 05-25-2017 09:12 AM
Code for multiple conditions to be met to display a pop up message Using multiple conditions with an IF statement?? to show a yes/no value 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
Code for multiple conditions to be met to display a pop up message Multiple If Conditions z941714 Excel 8 08-09-2015 04:12 PM
Code for multiple conditions to be met to display a pop up message Count with multiple conditions bundy5150 Excel 4 02-22-2011 10:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft