
find/replace in a Word Doc using word object and vbscript
That's correct, just use variable names that contain the correct value,
literals (string or numeric depending on what's needed), or named constants
(like True/False), all in the right position. You can skip any optional arg
where the default value is OK...
obj.method arg1varname,,"arg 3 literal",4,True,,,False
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
Quote:
> thanks, Michael. with the positional arguments, do i not even use
'ReadOnly
> = False'? would i just comma over to the 3rd argument and type'False'?
> please advise
> df
> > WordDoc.Documents.Open "c:\generic.doc", ConfirmConversions = True,
> ReadOnly
> > = False
> > is (almost) VBA syntax for named arguments (ReadOnly := False would be
> > correct VBA syntax).
> > In any case, VBScript does not support named argument syntax. You have
to
> > code everything as the correct positional argument.
> > object.method arg1,,arg3,,,,,,,arg10
> > Look up the methods correct positional syntax in the Word Visual Basic
> > documentation - it can get pretty ugly ;-)...
> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --
> > Please do not email questions - post them to the newsgroup instead.
> > --
> > > Help to anyone,
> > > i have this code:
> > > Dim WordDoc
> > > Set WordDoc = CreateObject("Word.Application")
> > > WordDoc.Visible = True
> > > WordDoc.Documents.Open "c:\generic.doc", ConfirmConversions = True,
> > > ReadOnly = False
> > > i have criteria to select certain words and then change the words, i
> find
> > > the words ok, but the script does nothing when i try to write to the
> word
> > > doc. it appears to be read-only, even though i am trying to open as
> > > read/write.
> > > is this readonly inherent to the Documents.Open?
> > > David Frank