×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Getting Error and Need Help ASAP

Getting Error and Need Help ASAP

Getting Error and Need Help ASAP

(OP)
I am trying to modify users' AD information using an Excel Spreadsheet.  Here is my script:

Set objExcel = CreateObject("Excel.Application")

objExcel.DisplayAlerts = False

'intRow = 2
strFile = "C:\script\test_emp_info.xls"
strDomain = "OU=PSTEST,DC=russellreynolds,DC=com"

Set objWorkbook = objExcel.Workbooks.Open(strFile)

Do Until objExcel.Cells(intRow,1).Value = ""
  Set objUser = GetObject("CN=" & objExcel.Cells(intRow,3 & intRow,2).Value "," & strDomain)
  objUser.physicalDeliveryOfficeName = objExcel.Cells(intRow,6).Value
  objUser.title = objExcel.Cells(intRow,8).Value
  objUser.SetInfo
 
  intRow = intRow + 1
Loop

objExcel.Quit

But I get the following error:

Line: 40
Char: 77
Error: Expected ')'
Code: 800A03EE

Any help asap would be greatly appreciated.

RE: Getting Error and Need Help ASAP

(OP)
I found the issue with the above script.  I left out an &.

Here is the code:

Dim objExcel, objWorkbook, objUser, strDomain, intRow, strFile

Set objExcel = CreateObject("Excel.Application")

objExcel.DisplayAlerts = False

'intRow = 2
strFile = "C:\script\test_emp_info.xls"
strDomain = "OU=PSTEST,DC=russellreynolds,DC=com"

Set objWorkbook = objExcel.Workbooks.Open(strFile)

Do Until objExcel.Cells(intRow,1).Value = ""
  Set objUser = GetObject("CN=" & objExcel.Cells(intRow,3 & intRow,2).Value & "," & strDomain)
  objUser.physicalDeliveryOfficeName = objExcel.Cells(intRow,6).Value
  objUser.title = objExcel.Cells(intRow,8).Value
  objUser.SetInfo
 
  intRow = intRow + 1
Loop

objExcel.Quit

Now when I run it, I get the following error:

Line: 13
Char: 1
Error: Unknown runtime error
Code: 800A03EC

Any help asap is greatly appreciated.

RE: Getting Error and Need Help ASAP

If, according to the first error this line is Line 40:

CODE

Set objUser = GetObject("CN=" & objExcel.Cells(intRow,3 & intRow,2).Value & "," & strDomain)

then Line 13 isn't even displayed in the code you've given.

Can you identify which line of code you are getting the error in please?

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software."  <-- Me

For all your testing needs: forum1393: Systems & Software Testing

RE: Getting Error and Need Help ASAP

>Set objUser = GetObject("CN=" & objExcel.Cells(intRow,3 & intRow,2).Value & "," & strDomain)
If you go slower, you would go farther! This line has no chance to be correct. At least this.
Set objUser = GetObject("LDAP://" & "CN=" & objExcel.Cells(intRow,3 & intRow,2).Value & "," & strDomain)

RE: Getting Error and Need Help ASAP

(OP)
Thank you all for your help.  To answer your question PHV, intRow = 2 is commented because there are no column headers.  I made the suggested changes.  Here is the code:

Dim objExcel, objWorkbook, objUser, strDomain, intRow, strFile

Set objExcel = CreateObject("Excel.Application")

objExcel.DisplayAlerts = False

'intRow = 2
strFile = "C:\script\test_emp_info.xls"
'strDomain = "OU=PSTEST,DC=russellreynolds,DC=com"

Set objWorkbook = objExcel.Workbooks.Open(strFile)

Do Until objExcel.Cells(intRow,1).Value = ""
  Set objUser = GetObject("LDAP//" & "CN=" & objExcel.Cells(intRow,3).Value & objExcel.Cells(intRow,2).Value & "," & strDomain)
  objUser.physicalDeliveryOfficeName = objExcel.Cells(intRow,6).Value
  objUser.title = objExcel.Cells(intRow,8).Value
  objUser.SetInfo
  
  intRow = intRow + 1
Loop

objExcel.Quit

I still get the following error:

Line: 13
Char: 1
Error: Unknown runtime error
Code: 800A03EC
 
 

RE: Getting Error and Need Help ASAP

(OP)
Yup, PHV, that did it.  I tried that this morning.  Now I am getting the following error:

Line:14
Char:3
Code:800401E4

This is pointing to the LDAP line.

RE: Getting Error and Need Help ASAP

(OP)
the value of strDomain is the target OU and domain that I want to bind to.  It is declared in the script.

RE: Getting Error and Need Help ASAP

It is declared in the script
But the value assignment is commented out ...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close