Question VB 6.0 URGENTE!!!

Résolu
tangjun Messages postés 4 Date d'inscription jeudi 9 juin 2005 Statut Membre Dernière intervention 15 juin 2005 - 9 juin 2005 à 14:22
tangjun Messages postés 4 Date d'inscription jeudi 9 juin 2005 Statut Membre Dernière intervention 15 juin 2005 - 9 juin 2005 à 16:06
J'ai fait un bouton qui lie pour ouvrir un repertoire avec le code suivant:




Dim myapp as Object


myapp = Shell("C:\WINDOWS\explorer.exe App.Path\..\cce final\fiches",3)



Il peut exécuter,mais donne une erreur apres avoir ouvert le fenetre




RUN-TIME ERROR 91:


Object variable pr With block variable not set



qn le comprend pourquoi?

Merci,je suis tres urgent pour cette question

7 réponses

redblast Messages postés 27 Date d'inscription mercredi 20 octobre 2004 Statut Membre Dernière intervention 27 juin 2005
9 juin 2005 à 14:35
Salut,



Shell ne renvoie pas un objet, mais un long:



Dim myapp as Long

myapp = Shell("C:\WINDOWS\explorer.exe App.Path\..\cce final\fiches",3)
3
cs_franckydeluka Messages postés 228 Date d'inscription mardi 5 avril 2005 Statut Membre Dernière intervention 4 janvier 2008 1
9 juin 2005 à 14:49
lol l'instruction shell renvoie un integer

Dim myapp as Integer
myapp = Shell("C:\WINDOWS\explorer.exe App.Path\..\cce final\fiches",3)



Deluka.
3
redblast Messages postés 27 Date d'inscription mercredi 20 octobre 2004 Statut Membre Dernière intervention 27 juin 2005
9 juin 2005 à 14:52
Edit:



Le mieux pour ouvrir un répertoire c'est d'utiliser l'API ShellExecute, dans les déclarations rajoute ca:



Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

Private Const SW_SHOW = 5



Et dans ton bouton utilise ça:



ShellExecute Form1.hwnd, "open", app.path & "\..\cce final\fiches", vbNullString, vbNullString, SW_SHOW
0
cs_franckydeluka Messages postés 228 Date d'inscription mardi 5 avril 2005 Statut Membre Dernière intervention 4 janvier 2008 1
9 juin 2005 à 14:54
>>>> lololol pardon je viens de regarder la msdn et elle dit que l'instruction shell renvoie un double
j'ai voulu aller trop vite lol. mais integer ou long ça marche aussi



Deluka.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
redblast Messages postés 27 Date d'inscription mercredi 20 octobre 2004 Statut Membre Dernière intervention 27 juin 2005
9 juin 2005 à 14:54
franckydeluka: ok pour l'integer, je pensais que c'était un long :)
0
redblast Messages postés 27 Date d'inscription mercredi 20 octobre 2004 Statut Membre Dernière intervention 27 juin 2005
9 juin 2005 à 14:56
[auteurdetail.aspx?ID= 483943 ]franckydeluka: ok pour le double alors

[auteurdetail.aspx?ID=483943
][auteurdetail.aspx?ID=483943 ][auteurdetail.aspx?ID =483943 ]
0
tangjun Messages postés 4 Date d'inscription jeudi 9 juin 2005 Statut Membre Dernière intervention 15 juin 2005
9 juin 2005 à 16:06
Merci bien!!!

Ca m'ai aidé beacoup pour mon programme.
0
Rejoignez-nous