Well, you do have two Loops and one Do in
the code you posted, so that doesn't doesn't
provide much of a clue.
If the Do/Loops check out then look for unmatched
If/End If in that section of code. The debugger gets
confused when counting If/End If with Do... With... For...
> Hope someone can help ive got a "Loop Without Do" error on line 316. and i
> cant see why..
>
> Line 316 is the last Loop Statement in the below code.
>
> kr
>
> Paul
>
> '260--------------------------------------------------------------------
>
> ' Group DN's start in column 12.
>
> intCol = 8
> Do While objSheet.Cells(intRow, intCol).Value <> ""
> strGroupDN = Trim(objSheet.Cells(intRow, intCol).Value)
> ' Attempt to bind to group object DN.
> blnBound = False
> On Error Resume Next
> Set objGroup = GetObject("LDAP://" & strGroupDN)
> If (Err.Number <> 0) Then
> On Error GoTo 0
> '365 Try again converting NT Name to DN.
> On Error Resume Next
> objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain _
> & "\" & strGroupDN
> If (Err.Number <> 0) Then
> On Error GoTo 0
> Wscript.Echo "Unable to bind to group " &
> strGroupDN
> Else
> On Error GoTo 0
> strGroupDN = objTrans.Get(ADS_NAME_TYPE_1779)
> Set objGroup = GetObject("LDAP://" & strGroupDN)
> blnBound = True
> End If
> Else
> On Error GoTo 0
> blnBound = True
> End If
> If (blnBound = True) Then
> objGroup.Add objUser.AdsPath
> If (Err.Number <> 0) Then
> On Error GoTo 0
> Wscript.Echo "Unable to add user " & strNTName _
> & " to group " & strGroupDN
> End If
> End If
> On Error GoTo 0
> ' Increment to next group DN.
> intCol = intCol + 1
>
>
> Loop
> End If
> End If
> End If
>
> '308---------------------------------------------
>
> ' Increment to next user.
> intRow = intRow + 1
>
> ' ... In the loop.
> ' Add new user to the group.
> objGroup.Add oNewUser.AdsPath
> Loop
>
> Wscript.Echo "Done"
>
> ' Clean up.
>
> objExcel.ActiveWorkbook.Close
> objExcel.Application.Quit
> Set objUser = Nothing
> Set objGroup = Nothing
> Set objContainer = Nothing
> Set objSheet = Nothing
> Set objExcel = Nothing
> Set objFSO = Nothing
> Set objShell = Nothing
> Set objTrans = Nothing
> Set objRootDSE = Nothing
>