Re: Open all docs in folder by Mark
Mark
Fri Mar 31 07:34:01 CST 2006
Thanks,
i have tried this and altered the folder path to suit, it finds the first
file and then debugs on the 'set pDoc = Documents.Open(pFileName)' line with
a run-time rror 5174 'this file could not be found'.
Try one of the following
Check spelling of the document
Try a different filename
Equally when I change the path to 'R' drive (a network drive) it doesn't
find anything and end subs.
Any ideas?
--
Mark
"Jezebel" wrote:
> Dim pFileName as string
> Dim pDoc as Word.Document
>
> pFileName = Dir("C:\MyFolder\*.doc")
> Do until len(pFileName) = 0
> set pDoc = Documents.Open(pFileName)
> ... do whatever with pDoc
> pDoc.Close SaveChanges:=TRUE
> pFileName = Dir
> Loop
>
>
>
>
>
>
> "Mark" <Mark@discussions.microsoft.com> wrote in message
> news:1CB9E09C-03E0-43D7-88C2-789FD92897D8@microsoft.com...
> >i am using ?office 97 upwards.
> >
> > Cansomeone asist me with some code which looks in a particular folder,
> > opens
> > each document one by one and does something then saves it and closes it
> > and
> > open next document.
> >
> > Open each doc in folder 1 by 1
> >
> > with active doc
> >
> > do something
> >
> > save document
> >
> > close document
> >
> > next document
> >
> >
> > --
> > Mark
>
>
>