Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1400 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Aide en VB script svp

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Aide en VB script svp

n°1627625
kouzema
Posté le 19-10-2007 à 19:20:30  profilanswer
 

Bonjour les experts  j espere que vous allez bien
 
j'aimerai avoir votre aide svp sur un script
 
Voila je suis entrain de faire un script pour la creation des utilisateurs par leur OU
 
je vous met ici mon script et mon fichier excel
 
J' ai un message d'erreur de style  
 
Script c:\documents and settings\Administrators\desktop\userinou.vbs
 
Line 1
Char 1
Error ActiveX component can't create object 'Excel application'
Code 800A01AD
Source VBScript runtime error
 
 
Mon script :
 
Set objExcel = CreateObject(" Excel.Application" )
Set objWorkbook = objExcel.Workbooks.Open("C:\users.xls" )
intRow = 2
Site = "storks"
Do Until objExcel.Cells(intRow,1).Value = ""
     Nom = objExcel.Cells(intRow, 1).Value
     Prenom = objExcel.Cells(intRow, 2).value
     NomCompte = Prenom & " " & Nom
     Compte = Nom
     Email = Prenom & "." & Nom & "@ storks.com"
     ComptePrincipal = Nom & "@storks.com"
     NomAffiche = Nom & " " & Prenom
 
 Set objDomain = GetObject("LDAP://dc=storks,dc=com" )
 
 Set objOU = objDomain.Create("organizationalUnit", "ou=Management" )
 objOU.SetInfo
 
     Set objOU = GetObject("LDAP://ou=Management,dc=storks,dc=com" )  
     Set objUser = objOU.Create("User", "cn=&NomCompte" )
     objUser.sAMAccountName = Compte
     objUser.UserPrincipalName = ComptePrincipal
     objUser.GivenName = Prenom
     objUser.SN = Nom
     objUser.Mail = Email
     objUser.DisplayName = NomAffiche
     objUser.SetInfo
 
     objUser.AccountDisabled = FALSE
     objUser.SetPassword Prenom
     objUser.Put "pwdLastSet", 0
     objUser.SetInfo
     intRow = intRow + 1
Loop
Wscript.echo "Opération terminée"
objExcel.Quit
 
Mon fichier excel
 
NOM     Prénom NomCompte Compte    Email                                  ComptePrincipal          
BOISSERON Monique    MBOISSERON    BOISSERON Monique.BOISSERON@storks.com   MBOISSERON@storks.com  
 
NomAffiche
BOISSERONMonique
 
 
Voila si quelqu'un peut m'aider si y a quelqu'un veut rajouter qqchse sur mon script vous êtes le bienvenu je suis novice en scritp donc j'attends votre avis merci d'avance
 
 
 
 
 

mood
Publicité
Posté le 19-10-2007 à 19:20:30  profilanswer
 

n°1627691
c_moa
Posté le 19-10-2007 à 20:33:31  profilanswer
 

Il y a un espace inutile dans  (" Excel.Application" )
Set objExcel = CreateObject("Excel.Application" )


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Aide en VB script svp

 

Sujets relatifs
Perte de focus clavier inexpliqué, aide bienvenue !Aide programme Jeu : Devinez le bon chiffre
[Batch-XP] "Unseter" une variable ?éxécution de flash avec script php,pb: perte parametres
Aide script dos de base[EXCEL] Aide à la programmation : besoin de conseils
Execution d'un script photoshopcherche aide pour un script
Plus de sujets relatifs à : Aide en VB script svp


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR