Hi,I have some code at the end of this post, part of an agent I am writing.
Basically, it looks for a certain field on the document. If the field doesn’t have any embedded objects then, set the field to blank. If it has any embeddeded attachments in that field, remove them looping until they are all gone.
Having done that, if the field still isn’t blank (the user entered text and attachments for example), then set it to blank and reload user interface doc…
This is working, but there is now other fields I want to blank out. To avoid reems and reems of code, is it possible to alter this so that, it scrolls through the fields…
e.g. as well as doing all that to the RGDocumentation1 field, it does all the same to about four other fields?
Here’s the code:
'blank out RT fields. Current setup will remove Attachments & Text.
'User should not enter other type
Set item = doc.GetFirstItem(“RGDocumentation1”)
If Isempty (item.EmbeddedObjects) Then
doc.RGDocumentation1=“”
Call uidoc.Reload
Exit Sub
End If
If item.EmbeddedObjects(0).Type <> EMBED_ATTACHMENT Then
doc.RGDocumentation1=“”
Call uidoc.Reload
Exit Sub
Else
Forall o In item.EmbeddedObjects
Call item.EmbeddedObjects(0).Remove
End Forall
End If
If doc.RGDocumentation1<> “” Then
doc.RGDocumentation1= “”
Call uidoc.Reload
End If
End If
'end code=============
The other fields I’d like to blank out are called:
RGDocumentation1_1
RGDocumentation2
RGDocumentation2_1