Bonjour=20
j'utilise word et excel dans mon appli VB,
pour tester si ces programme sont bien install=E9 sur le=20
poste client, je fais le code suivant :
ya t'il un autre moyen que de faire des "CreateObject" qui=20
m'oblige a installer la Library Microsoft Scripting=20
Runtime sur le poste client.=20
des api par exemple ?
merci
CODE :
Dim ObjW As Word.Application
Dim ObjX As excel.Application
Select Case UCase$(CodeAppli)
Case "WORD": Set ObjW =3D CreateObject
("word.application")
Case "EXCEL": Set ObjX =3D CreateObject
("excel.application")
'Case "OUTLOOK": Set ObjO =3D CreateObject
("outlook.application")
End Select
If Err.Number =3D 429 Then
Select Case UCase$(CodeAppli)
Case "WORD", "EXCEL": MsgBox "MICROSOFT " &=20
UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly +=20
vbCritical
'Case "OUTLOOK": MsgBox "MICROSOFT " &=20
UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly +=20
vbCritical
End Select
Err.Clear
ApplicationInstalle =3D False
Exit Function
Else
Select Case UCase$(CodeAppli)
Case "WORD": ObjW.Quit: Set ObjW =3D Nothing
Case "EXCEL": ObjX.Quit: Set ObjX =3D Nothing
'Case "OUTLOOK": ObjO.Quit: Set ObjO =3D Nothing
End Select
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Cyril Marchal
Bonjour/soir,
j'utilise ce style de code pour tester ou non la présence d'excel ou de toute autre application sur un ordinateur client. Vous remarquerez que je déclare une variable en objet et non en "Word.application".
D'autre part, CreateObject ne nécessite pas l'utilisation du Microsoft Scripting Runtime.
Private Function fcExcelPresent() As Boolean Dim MyObj As Object Dim boolExcelPresent As Boolean On Error GoTo Excel_Not_Present fcExcelPresent = True Set MyObj = CreateObject("Excel.Application") Exit Function Excel_Not_Present: fcExcelPresent = False Resume Next End Function
En espérant vous avoir aidé.
Cyril Marchal.
"laetitia" a écrit dans le message news: 0b1801c38819$3ad6ee30$ Bonjour j'utilise word et excel dans mon appli VB, pour tester si ces programme sont bien installé sur le poste client, je fais le code suivant :
ya t'il un autre moyen que de faire des "CreateObject" qui m'oblige a installer la Library Microsoft Scripting Runtime sur le poste client. des api par exemple ?
merci
CODE :
Dim ObjW As Word.Application Dim ObjX As excel.Application
Select Case UCase$(CodeAppli) Case "WORD": Set ObjW = CreateObject ("word.application") Case "EXCEL": Set ObjX = CreateObject ("excel.application") 'Case "OUTLOOK": Set ObjO = CreateObject ("outlook.application") End Select If Err.Number = 429 Then Select Case UCase$(CodeAppli) Case "WORD", "EXCEL": MsgBox "MICROSOFT " & UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly + vbCritical 'Case "OUTLOOK": MsgBox "MICROSOFT " & UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly + vbCritical End Select Err.Clear ApplicationInstalle = False Exit Function Else Select Case UCase$(CodeAppli) Case "WORD": ObjW.Quit: Set ObjW = Nothing Case "EXCEL": ObjX.Quit: Set ObjX = Nothing 'Case "OUTLOOK": ObjO.Quit: Set ObjO = Nothing End Select
Bonjour/soir,
j'utilise ce style de code pour tester ou non la présence d'excel ou de
toute autre application sur un ordinateur client.
Vous remarquerez que je déclare une variable en objet et non en
"Word.application".
D'autre part, CreateObject ne nécessite pas l'utilisation du Microsoft
Scripting Runtime.
Private Function fcExcelPresent() As Boolean
Dim MyObj As Object
Dim boolExcelPresent As Boolean
On Error GoTo Excel_Not_Present
fcExcelPresent = True
Set MyObj = CreateObject("Excel.Application")
Exit Function
Excel_Not_Present:
fcExcelPresent = False
Resume Next
End Function
En espérant vous avoir aidé.
Cyril Marchal.
"laetitia" <laetitiadf@hotmail.com> a écrit dans le message news:
0b1801c38819$3ad6ee30$a001280a@phx.gbl...
Bonjour
j'utilise word et excel dans mon appli VB,
pour tester si ces programme sont bien installé sur le
poste client, je fais le code suivant :
ya t'il un autre moyen que de faire des "CreateObject" qui
m'oblige a installer la Library Microsoft Scripting
Runtime sur le poste client.
des api par exemple ?
merci
CODE :
Dim ObjW As Word.Application
Dim ObjX As excel.Application
Select Case UCase$(CodeAppli)
Case "WORD": Set ObjW = CreateObject
("word.application")
Case "EXCEL": Set ObjX = CreateObject
("excel.application")
'Case "OUTLOOK": Set ObjO = CreateObject
("outlook.application")
End Select
If Err.Number = 429 Then
Select Case UCase$(CodeAppli)
Case "WORD", "EXCEL": MsgBox "MICROSOFT " &
UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly +
vbCritical
'Case "OUTLOOK": MsgBox "MICROSOFT " &
UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly +
vbCritical
End Select
Err.Clear
ApplicationInstalle = False
Exit Function
Else
Select Case UCase$(CodeAppli)
Case "WORD": ObjW.Quit: Set ObjW = Nothing
Case "EXCEL": ObjX.Quit: Set ObjX = Nothing
'Case "OUTLOOK": ObjO.Quit: Set ObjO = Nothing
End Select
j'utilise ce style de code pour tester ou non la présence d'excel ou de toute autre application sur un ordinateur client. Vous remarquerez que je déclare une variable en objet et non en "Word.application".
D'autre part, CreateObject ne nécessite pas l'utilisation du Microsoft Scripting Runtime.
Private Function fcExcelPresent() As Boolean Dim MyObj As Object Dim boolExcelPresent As Boolean On Error GoTo Excel_Not_Present fcExcelPresent = True Set MyObj = CreateObject("Excel.Application") Exit Function Excel_Not_Present: fcExcelPresent = False Resume Next End Function
En espérant vous avoir aidé.
Cyril Marchal.
"laetitia" a écrit dans le message news: 0b1801c38819$3ad6ee30$ Bonjour j'utilise word et excel dans mon appli VB, pour tester si ces programme sont bien installé sur le poste client, je fais le code suivant :
ya t'il un autre moyen que de faire des "CreateObject" qui m'oblige a installer la Library Microsoft Scripting Runtime sur le poste client. des api par exemple ?
merci
CODE :
Dim ObjW As Word.Application Dim ObjX As excel.Application
Select Case UCase$(CodeAppli) Case "WORD": Set ObjW = CreateObject ("word.application") Case "EXCEL": Set ObjX = CreateObject ("excel.application") 'Case "OUTLOOK": Set ObjO = CreateObject ("outlook.application") End Select If Err.Number = 429 Then Select Case UCase$(CodeAppli) Case "WORD", "EXCEL": MsgBox "MICROSOFT " & UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly + vbCritical 'Case "OUTLOOK": MsgBox "MICROSOFT " & UCase$(CodeAppli) & LoadResString(gLG + 483), vbOKOnly + vbCritical End Select Err.Clear ApplicationInstalle = False Exit Function Else Select Case UCase$(CodeAppli) Case "WORD": ObjW.Quit: Set ObjW = Nothing Case "EXCEL": ObjX.Quit: Set ObjX = Nothing 'Case "OUTLOOK": ObjO.Quit: Set ObjO = Nothing End Select