#Naming: Hungarian Notation is the DEVIL. ###It makes the reader want to see your code burn in eternal flames.
Naming: Hungarian Notation is the DEVIL.
It makes the reader want to see your code burn in eternal flames.
objExcelwould be better off asxlApporexcelAppobjUseris dying to call itself something likeadUserintRowwants to be calledxlRowor justrowintUACis silently begging for a more descriptive nameobjOUwants to shoot whoever named it that
Now, whether your code is correct or not is off-topic for this site; since this question hasn't been closed as off-topic yet, I'm going to assume you've got working code.
Do Until objExcel.Cells(intRow,1).Value = ""
I'd use vbNullString here instead of "". It makes the intent clearer, and the non-string takes up 0 bytes. "" eats 6 bytes for no reason - StrPtr(vbNullString) is 0; StrPtr("") is a non-zero memory address.
The repeated assignments on objUser are a missed opportunity of using a With block:
With objOU.Create("User", "cn=" & objExcel.Cells(intRow, 3).Value, _
objExcel.Cells(intRow, 2).Value, _
objExcel.Cells(intRow, 19).Value)
.SAMAccountName = objExcel.Cells(intRow, 19).Value & ".sat"
.GivenName = objExcel.Cells(intRow, 3).Value
.SN = objExcel.Cells(intRow, 2).Value
.AccountDisabled = False
.AccountExpirationDate = Date + 365
'...
End With
Your usage of line continuation characters is... well, you use it in weird places. Actually, everywhere you've used it, I wouldn't have. Notice in the above snippet, how I used it to line up the parameters.
