Home All Groups Group Topic Archive Search About
Author
6 Jun 2006 2:39 PM
Brian
Hello. I am comparing the beginning of a string to another string using the
StartsWith() function. My line of code is:

if checkPrinter.StartsWith("\\medea\") then
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
end if

When the program gets to the line with the StartsWith(), I get an error
stating:

Object Required: 'Microsoft Office Doc'

Anybody know what this means? I am using Visual Studio .net 2003 to do a
..vbs. Thanks for any help!!

Brian

Author
6 Jun 2006 3:16 PM
Charlie Brown
What kind of object is checkPrinter?

Brian wrote:
Show quoteHide quote
> Hello. I am comparing the beginning of a string to another string using the
> StartsWith() function. My line of code is:
>
> if checkPrinter.StartsWith("\\medea\") then
> WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
> end if
>
> When the program gets to the line with the StartsWith(), I get an error
> stating:
>
> Object Required: 'Microsoft Office Doc'
>
> Anybody know what this means? I am using Visual Studio .net 2003 to do a
> .vbs. Thanks for any help!!
>
> Brian
Author
6 Jun 2006 3:25 PM
Brian
Its a string that holds the path to a printer such as: \\medea\printer1

Show quoteHide quote
"Charlie Brown" wrote:

> What kind of object is checkPrinter?
>
> Brian wrote:
> > Hello. I am comparing the beginning of a string to another string using the
> > StartsWith() function. My line of code is:
> >
> > if checkPrinter.StartsWith("\\medea\") then
> > WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
> > end if
> >
> > When the program gets to the line with the StartsWith(), I get an error
> > stating:
> >
> > Object Required: 'Microsoft Office Doc'
> >
> > Anybody know what this means? I am using Visual Studio .net 2003 to do a
> > .vbs. Thanks for any help!!
> >
> > Brian
>
>
Author
6 Jun 2006 3:54 PM
Charlie Brown
Use this instead.

if InStr(1, checkPrinter, "\\medea\") then
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
end if

Brian wrote:
Show quoteHide quote
> Its a string that holds the path to a printer such as: \\medea\printer1
>
> "Charlie Brown" wrote:
>
> > What kind of object is checkPrinter?
> >
> > Brian wrote:
> > > Hello. I am comparing the beginning of a string to another string using the
> > > StartsWith() function. My line of code is:
> > >
> > > if checkPrinter.StartsWith("\\medea\") then
> > > WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
> > > end if
> > >
> > > When the program gets to the line with the StartsWith(), I get an error
> > > stating:
> > >
> > > Object Required: 'Microsoft Office Doc'
> > >
> > > Anybody know what this means? I am using Visual Studio .net 2003 to do a
> > > .vbs. Thanks for any help!!
> > >
> > > Brian
> >
> >
Author
6 Jun 2006 4:26 PM
Brian
It worked great!  Thanks alot!!!!


Show quoteHide quote
"Charlie Brown" wrote:

> Use this instead.
>
> if InStr(1, checkPrinter, "\\medea\") then
> WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
> end if
>
> Brian wrote:
> > Its a string that holds the path to a printer such as: \\medea\printer1
> >
> > "Charlie Brown" wrote:
> >
> > > What kind of object is checkPrinter?
> > >
> > > Brian wrote:
> > > > Hello. I am comparing the beginning of a string to another string using the
> > > > StartsWith() function. My line of code is:
> > > >
> > > > if checkPrinter.StartsWith("\\medea\") then
> > > > WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
> > > > end if
> > > >
> > > > When the program gets to the line with the StartsWith(), I get an error
> > > > stating:
> > > >
> > > > Object Required: 'Microsoft Office Doc'
> > > >
> > > > Anybody know what this means? I am using Visual Studio .net 2003 to do a
> > > > .vbs. Thanks for any help!!
> > > >
> > > > Brian
> > >
> > >
>
>