Hi all

I am trying to open all documents from a filepath, run a macro that deletes
the watermark, save and close the document. Is this possible.

What I have so far errors as marked below:

Sub Test()

Dim Odoc As Word.Documents

Set fs = Application.FileSearch
With fs
.LookIn = path '"C:\"
.FileName = "*.doc"
' ' .Open (fail)

End With

For Each Odoc In fs ' I get an error here, Object doesnt support
this property
Call DeleteGraphic
Odoc.save
Odoc.close
Next Odoc

'End With
End Sub

Thanks in advance

RE: Can VBA open docs from filepath and run an action? by HelmutWeber

HelmutWeber
Fri Feb 17 02:49:27 CST 2006

Hi Sydney,

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000

Re: Can VBA open docs from filepath and run an action? by Sydney

Sydney
Sun Feb 19 16:50:54 CST 2006

These work like a charm!
Thank you so much Edward and Helmut.


"Edward Thrashcort" <IdontWantSpam@nospam.net> wrote in message
news:memo.20060217092350.20653C@eonsol.compulink.co.uk...
> Use the Dir() statement and open the document by name something like this
>
> ChangeFileOpenDirectory "C:\My Documents"
> f = Dir("*.doc")
> While f <> ""
> Documents.Open Filename:=f
> 'do the business
> ActiveDocument.Close SaveChanges:=wdSaveChanges
> f = Dir()
> Wend
>
>
> Eddie
>
> > *From:* "Sydney" <sydneygal25@yahoo.com>
> > *Date:* Fri, 17 Feb 2006 16:57:09 +1100
> >
> > Hi all
> >
> > I am trying to open all documents from a filepath, run a macro that
> > deletes
> > the watermark, save and close the document. Is this possible.
> >
> > What I have so far errors as marked below:
> >
> > Sub Test()
> >
> > Dim Odoc As Word.Documents
> >
> > Set fs = Application.FileSearch
> > With fs
> > .LookIn = path '"C:\"
> > .FileName = "*.doc"
> > ' ' .Open (fail)
> >
> > End With
> >
> > For Each Odoc In fs ' I get an error here, Object doesnt
> > support
> > this property
> > Call DeleteGraphic
> > Odoc.save
> > Odoc.close
> > Next Odoc
> >
> > 'End With
> > End Sub
> >
> > Thanks in advance
> >
> >
> >
>