Is there a way to check to see if a docvariable exist before I run a line of code in vba?
I currently do this with bookmarks using the following code:
If ActiveDocument.Bookmarks.Exists(“LumpSum”) = True Then ActiveDocument.Variables(“varProjCost”).Value = .MostRecentProjDesc
I do this because the document variable in the above code is within a bookmark that can be deleted if the person make a specific selection in a userform. So if the bookmark isn’t there then the variable isn’t there so I don’t want to set its value.
So I want to do the same with another variable but the variable isn’t in a bookmark but could have been deleted by the userform. Is there a similar .Exists command for a docvariable?
I’m trying to avoid errors.
Thanks