Ragnar
Ragnar

Reputation: 1582

Wrong Number of arguments, or invalid property assignment: 'instr' line 5

Hey I wanted to take the loop below and also make it skip admin shares if the share starts with "_o _"

my loop is:

'Compares The UnApproved Shares to the Current Shares
    For Each objItem In colItems
        Dim StrNonUnapprovedShares, Item
        StrCurrentShares = objItem.name
    if instr(AdminShares,lcase(objitem.name)) > 0 or mid(objitem.name,2,1) = "$" or left(lcase(objitem.name),10) = "pkgsvrhost" or instr("_o_") > 0 then
        'Skipping known admin share
    Else
            For each Item in arrUnApprovedLines
            If Lcase(Item) = Lcase(strCurrentShares) Then
                StrNonUnapprovedShares = (StrNonUnapprovedShares & strCurrentShares & vbCrLf)
            End If

        Next
    End If
Next

I inserted an "or instr("_O _")" after the "pkgsvrhost" on the 5th line, but it errored with the error --type mismatch" '[string: "_O _"]--

Upvotes: 0

Views: 555

Answers (1)

Nathan Rice
Nathan Rice

Reputation: 3111

Try this:

Or Instr(objitem.name, "_O_") > 0

Upvotes: 0

Related Questions