Object required

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    #1

    Object required

    Hello. I am comparing the beginning of a string to another string using the
    StartsWith() function. My line of code is:

    if checkPrinter.St artsWith("\\med ea\") then
    WshNetwork.Remo vePrinterConnec tion 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
  • Charlie Brown

    #2
    Re: Object required

    What kind of object is checkPrinter?

    Brian wrote:[color=blue]
    > Hello. I am comparing the beginning of a string to another string using the
    > StartsWith() function. My line of code is:
    >
    > if checkPrinter.St artsWith("\\med ea\") then
    > WshNetwork.Remo vePrinterConnec tion 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[/color]

    Comment

    • Brian

      #3
      Re: Object required

      Its a string that holds the path to a printer such as: \\medea\printer 1

      "Charlie Brown" wrote:
      [color=blue]
      > What kind of object is checkPrinter?
      >
      > Brian wrote:[color=green]
      > > Hello. I am comparing the beginning of a string to another string using the
      > > StartsWith() function. My line of code is:
      > >
      > > if checkPrinter.St artsWith("\\med ea\") then
      > > WshNetwork.Remo vePrinterConnec tion 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[/color]
      >
      >[/color]

      Comment

      • Charlie Brown

        #4
        Re: Object required

        Use this instead.

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

        Brian wrote:[color=blue]
        > Its a string that holds the path to a printer such as: \\medea\printer 1
        >
        > "Charlie Brown" wrote:
        >[color=green]
        > > What kind of object is checkPrinter?
        > >
        > > Brian wrote:[color=darkred]
        > > > Hello. I am comparing the beginning of a string to another string using the
        > > > StartsWith() function. My line of code is:
        > > >
        > > > if checkPrinter.St artsWith("\\med ea\") then
        > > > WshNetwork.Remo vePrinterConnec tion 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[/color]
        > >
        > >[/color][/color]

        Comment

        • Brian

          #5
          Re: Object required

          It worked great! Thanks alot!!!!


          "Charlie Brown" wrote:
          [color=blue]
          > Use this instead.
          >
          > if InStr(1, checkPrinter, "\\medea\") then
          > WshNetwork.Remo vePrinterConnec tion oPrinters.Item( i+1), true, false
          > end if
          >
          > Brian wrote:[color=green]
          > > Its a string that holds the path to a printer such as: \\medea\printer 1
          > >
          > > "Charlie Brown" wrote:
          > >[color=darkred]
          > > > 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.St artsWith("\\med ea\") then
          > > > > WshNetwork.Remo vePrinterConnec tion 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
          > > >
          > > >[/color][/color]
          >
          >[/color]

          Comment

          Working...