Se connecter avec
S'enregistrer | Connectez-vous

Comment ouvrir une page internet dans un code vba???

Dernière réponse : dans Programmation
Lassé par la pub ? Créez un compte
Expert Programmation

Je te propose :
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
Const SW_SHOWNORMAL = 1

ShellExecute vbNull, "open", "http://www.presence-pc.com", vbNull, vbNull, SW_SHOWNORMAL



Tu as un bout de texte qui traine en dessous d'un End Sub par exemple ( je verrai bien un End Sub doublé )

D'autre part pour que cela fonctionne
mettre le code suivant dans un module
Sous VBA : Menu Insertion | Module

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

Const SW_SHOWNORMAL = 1

Sub tst()
ShellExecute vbNull, "open", "http://www.presence-pc.com", vbNull, vbNull, SW_SHOWNORMAL
End Sub

Ensuite insérer un bouton sur Feuil1 et le lier à la procedure Tst()
Menu Affichage | Barre Outils | Formulaires
Sélectionner 4eme icône en haut à droite
Le "tracer" sur la feuille : une fenêtre "Affecter une macro" apparait
Sélectionner Tst() dans la liste déroulante
Lassé par la pub ? Créez un compte