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

recherche adresse IP sur Excel

3 réponses
Avatar
thierry
Je d=E9sire r=E9cup=E9rer l'adresse IP de mon ordinateur pour=20
effectuer un calcul.

Comment faire, simplement.

Merci.

3 réponses

Avatar
ChrisV
http://groups.google.com/groups?q­resse+IP+group:microsoft.public.fr.excel&hl=fr&lr=&ie=UTF-8&c2coff=1&selm=u0UHa%24K4CHA.1540%40TK2MSFTNGP09.phx.gbl&rnum=1


ChrisV


"thierry" a écrit dans le message de
news:219201c46ffb$a0ded8d0$
Je désire récupérer l'adresse IP de mon ordinateur pour
effectuer un calcul.

Comment faire, simplement.

Merci.
Avatar
Frédéric Sigonneau
Bonjour,

Deux autres approches possibles (fonctions VBA perso utilisables dans une
feuille de calcul ou dans du code) :

'========= si WMI est installé sur le PC (Win 2000 et XP
Function AdresseIP()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration where
IPEnabled=TRUE")

For Each IPConfig In IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
AdresseIP = IPConfig.IPAddress(i)
Next
End If
Next
End Function

'========== sinon, avec le "classique" ipconfig
Function MonIP()
Dim Commande$, wsh, fso, fich
Commande = "command.com /c ipconfig >d:config.txt"
Set wsh = CreateObject("WScript.Shell")
wsh.Run Commande, 0, True
Set fso = CreateObject("Scripting.FileSystemObject")
Set fich = fso.OpenTextFile("d:config.txt", 1)
MonIP = Split(Trim(Split(fich.readall, ":")(5)), Chr(13))(0)
fich.Close
Kill "d:config.txt"
End Function 'fs

FS
---
Frédéric Sigonneau [MVP Excel - né un sans-culottide]
Gestions de temps, VBA pour Excel :
http://perso.wanadoo.fr/frederic.sigonneau
Si votre question sur Excel est urgente, évitez ma bal !

Je désire récupérer l'adresse IP de mon ordinateur pour
effectuer un calcul.

Comment faire, simplement.

Merci.


Avatar
Misange
c'est ici :
http://www.excelabo.net/xl/application.php#adresseIP
:-)
Misange migrateuse http://www.excelabo.net
mail : http://cerbermail.com/?k5Q8Dh2mta


le 22/07/2004 16:53:
Je désire récupérer l'adresse IP de mon ordinateur pour
effectuer un calcul.

Comment faire, simplement.

Merci.