IncludeText if file exists

J

Jules

Is there a way in wording using fields that I can check if a file exists so
that if I use includetext and the file does not exist I do not get the Not a
Valid File Name error?
Thank you
 
D

Doug Robbins - Word MVP

You could use an If...then...Else field construction that checks for the
(exact) error message

{ IF { INCLUDETEXT "PATH/FILENAME" } <> "Error! Not a Valid FileName" {
INCLUDETEXT "PATH/FILENAME" } }

You will have to quote the exact error message in place of "Error! Not a
Valid FileName" for this to work.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
J

Jules

Thanks very much, exactly what I needed.

Doug Robbins - Word MVP said:
You could use an If...then...Else field construction that checks for the
(exact) error message

{ IF { INCLUDETEXT "PATH/FILENAME" } <> "Error! Not a Valid FileName" {
INCLUDETEXT "PATH/FILENAME" } }

You will have to quote the exact error message in place of "Error! Not a
Valid FileName" for this to work.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top