Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Ouverture fichier PDF depuis liste deroulante

Aucune réponse
Avatar
EnzoThibouret
Bonjour,

J'ai un soucis avec ma liste déroulante.
Une fois les items ajoutés, j'aimerais créer l'ouverture d'un fichier associé pour chaque choix mais mon code ne fonctionne pas.
J'ai tenté d'affecter une condition SI pour chaque choix mais rien n'y fait.
Extrait pour les deux premiers choix, le reste est identique

Le voici:

Public Sub ComboBox1_DropButtonClick()
ComboBox1.Clear
With ComboBox1
.AddItem "Fiche technique - Ascenseur"
.AddItem "Fiche technique - Boite aux lettres"
.AddItem "Fiche technique - Domotique"
.AddItem "Fiche technique - Electricité"
.AddItem "Fiche technique - Faïence"
.AddItem "Fiche technique - Baignoire/Bac de douche"
.AddItem "Fiche technique - Meuble SDB"
.AddItem "Fiche technique - Plinthes"
.AddItem "Fiche technique - WC suspendu"
.AddItem "Fiche technique - Placards"
.AddItem "Fiche technique - Plomberie"
.AddItem "Fiche technique - Quincaillerie"
.AddItem "Fiche technique - Sols"
End With
End Sub

Private Sub ComboBox1_Change()
If (ComboBox1.Text = "Fiche technique - Ascenseur") Then
Dim MonApplication As Object
Dim MonFichier As String
Set MonApplication = CreateObject("Shell.Application")

MonFichier = "S:BATIMENTBAT MPL TRAVAUX1 - MONTPELLIERPAPYRUSEnzo - PFE !!NE PAS SUPPRIMER!!LogicielFichiers sourcesFiches techniquesASCENSEUR - indE - Mise à jour au 01 05 2019_100-107.pdf"
MonApplication.Open (MonFichier)

Set MonApplication = Nothing
End If
If (ComboBox1.Text = "Fiche technique - Boite aux lettres") Then
Dim MonApplication1 As Object
Dim MonFichier1 As String
Set MonApplication1 = CreateObject("Shell.Application")

MonFichier1 = "S:BATIMENTBAT MPL TRAVAUX1 - MONTPELLIERPAPYRUSEnzo - PFE !!NE PAS SUPPRIMER!!LogicielFichiers sourcesFiches techniquesBOITE AUX LETTRES - indE - Mise à jour au 01 05 2019_81-84.pdf"
MonApplication1.Open (MonFichier)

Set MonApplication1 = Nothing
End If
End Sub

Quelqu'un a une idée?

Merci d'avance.

Réponses