In a previous post I presented macro code to capture the contents of a text frame. I am trying to add error processing, the aim is to fail silently if anything is missing.
I now have this code fragment:
On Error GoTo End
try:
oFrame = document.TextFrames
if IsError(oFrame) or isNull(oFrame) then exit sub
oField = oFrame.getByName("xxDocTitle") ‘ Exception here
if IsError(oField) then exit sub
if isNull(oField) or isNull(oField.String) or oField.String = "" then exit sub
filename = oField.String & ".odt"
Catch:
' Exit silently
end sub
it works if the text frame is empty but always produces an error dialogue if the frame is absent:
An exception occurred
Type: com.sun.star.container.NoSuchElementException
Message:.
Can I do anything to suppress the exception message?