Object required

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Its a string that holds the path to a printer such as: \\medea\printer1
 
Use this instead.

if InStr(1, checkPrinter, "\\medea\") then
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, false
end if
 
It worked great! Thanks alot!!!!


Charlie Brown said:
Use this instead.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top