You haven't posted enough code to diagnose. Are you saying that the code
does not throw an error even if the filename is no good?
Or is there a mistake in your error-handler, perhaps?
> Using MS Word 2003 and MS XP Professional
>
[quoted text clipped - 18 lines]
>
> Thanks for your help - this is driving me squirly
Eventhough file is present on the filesystem, if it is opened, you can't
open it in binary access read mode.
Therefor ,yr function FileThere() should be rewritten to read something
like:
Function FileThere(FileName As String) As Boolean
FileThere = (Dir(FileName) > "") And Not IsFileOpen(FileName)
End Function
'supporting function:
Function IsFileOpen(TargetFile as string) As Boolean
On Error GoTo ErrAccess
Dim i As Integer
i = FreeFile
Open TargetFile For Binary Access Read Lock Read As #i
Close #i
ExitHere:
Exit Function
ErrAccess:
IsFileOpen = True
Resume ExitHere
End Function
--
Krgrds,
Perry
System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
> Using MS Word 2003 and MS XP Professional
>
[quoted text clipped - 18 lines]
>
> Thanks for your help - this is driving me squirly
redryderridesagain@hotmail.com - 17 Feb 2007 22:24 GMT
Perry,
Thanks for your suggestion - putting the file open statement in a
subroutine works. I am not sure why the on error statement in the main
routine did not catch this but hey, I've learned something.
TkxAgn
Red