I'm getting an error - (11,12) expected end of statement.

'**************************************
'* This script creates user accounts. *
'**************************************
Set objExcel = CreateObject("Excel.Application") 'Set the correct file
location for the excel data file.
Set objWorkbook = objExcel.Workbooks.Open("L:\TRANSFER\Class Lists
2006\12a.xls")
domAddr = "@mcistudent.local" 'Set Variable for domain address.
intRow = 2 'Variable for loop. Begins on 2 to bypass header row.
Const ADS_PROPERTY_APPEND = 3 'Constant for adding to the group.
dim usrVar = "cn=" & objExcel.Cells(intRow,1).value 'new user's address.
Do Until objExcel.Cells(intRow,1).Value = "" 'Initiate loop. Set
objOU = GetObject("LDAP://ou=Senior Four,dc=mcistudent,dc=local") 'Create
Account.
Set objUser = objOU.Create("User",usrVar)

Re: Trouble Troubleshooting by Justin

Justin
Fri Sep 15 16:23:55 CDT 2006

On Fri, 15 Sep 2006 15:57:01 -0500, KWME <KWME@discussions.microsoft.com>
wrote:

> I'm getting an error - (11,12) expected end of statement.

That's actually line eleven, column twelve.

> dim usrVar = "cn=" & objExcel.Cells(intRow,1).value'new user's address.

You can't initialise variables as part of a Dim statement.

--
Justin Piper
Bizco Technologies
http://www.bizco.com/

Re: Trouble Troubleshooting by Brian

Brian
Fri Sep 15 16:48:25 CDT 2006

Justin Piper wrote:
>
>
>> dim usrVar = "cn=" & objExcel.Cells(intRow,1).value'new user's address.
>
> You can't initialise variables as part of a Dim statement.

You can, however, do something like this, although it does not appear to be
shown in the 5.6 docs (CHM format):

dim usrVar: usrVar = "cn=" & objExcel.Cells(intRow,1).value'new user's address.

Re: Trouble Troubleshooting by KWME

KWME
Sat Sep 16 18:58:01 CDT 2006

thanks guys. I'll give it a shot.

"Brian Wolven" wrote:

> Justin Piper wrote:
> >
> >
> >> dim usrVar = "cn=" & objExcel.Cells(intRow,1).value'new user's address.
> >
> > You can't initialise variables as part of a Dim statement.
>
> You can, however, do something like this, although it does not appear to be
> shown in the 5.6 docs (CHM format):
>
> dim usrVar: usrVar = "cn=" & objExcel.Cells(intRow,1).value'new user's address.
>

Re: Trouble Troubleshooting by OldDog

OldDog
Mon Sep 18 14:59:50 CDT 2006

I would think you would need a Loop statement at the end.

Do Until objExcel.Cells(intRow,1).Value = "" 'Initiate loop.
Set
objOU = GetObject("LDAP://ou=Senior Four,dc=mcistudent,dc=local")
'Create Account.
Set objUser = objOU.Create("User",usrVar)
Loop

KWME wrote:
> I'm getting an error - (11,12) expected end of statement.
>
> '**************************************
> '* This script creates user accounts. *
> '**************************************
> Set objExcel = CreateObject("Excel.Application") 'Set the correct file
> location for the excel data file.
> Set objWorkbook = objExcel.Workbooks.Open("L:\TRANSFER\Class Lists
> 2006\12a.xls")
> domAddr = "@mcistudent.local" 'Set Variable for domain address.
> intRow = 2 'Variable for loop. Begins on 2 to bypass header row.
> Const ADS_PROPERTY_APPEND = 3 'Constant for adding to the group.
> dim usrVar = "cn=" & objExcel.Cells(intRow,1).value 'new user's address.
> Do Until objExcel.Cells(intRow,1).Value = "" 'Initiate loop. Set
> objOU = GetObject("LDAP://ou=Senior Four,dc=mcistudent,dc=local") 'Create
> Account.
> Set objUser = objOU.Create("User",usrVar)