• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Msj Box İle Kullanıcı Ve Ip gösterme !!!

  • Konbuyu başlatan Konbuyu başlatan asas44
  • Başlangıç tarihi Başlangıç tarihi
Katılım
13 Temmuz 2013
Mesajlar
121
Excel Vers. ve Dili
2013 excel
Konu başlığında da belirttiğim gibi kullanıcı Exceli açtığı zaman oto msj box ile kullanıcının ismi ve ıp sini göstersin istiyorum mümkünmüdür acaba biraz araştırdım ama örneğini bulamadım Yardımcı olursanız yada elinizde bir örnek kod var ise paylaşırsanız sevinirim.
 
Sub Auto_open()
Beep

SATIR_1 = "KULLANICI/...." & Space(3) & " : " & Application.UserName & Space(2) & " / " & Environ("UserName")
SATIR_2 = "TARİH/SAAT" & Space(10) & " : " & CStr(Date) & " / " & CStr(Time)
SATIR_3 = "IP" & Space(29) & " : " & bu kısım
SATIR_4 = "İRTİBAT" & Space(8) & " : " & "................."
MsgBox SATIR_1 & vbCrLf & SATIR_2 & vbCrLf & _
SATIR_3 & vbCrLf & SATIR_4 & vbCrLf & SATIR_5 & vbCrLf & SATIR_6 & vbCrLf & _
"==>..............<==", vbInformation, ".................."

End Sub

sadece ip kısmında takıldım ??
 
. . .

Kod:
Sub Auto_open()
    Beep
    
    If Err.Number <> 0 Then
        MsgBox "WMI yüklenmemis! Programdan çikilacak...", vbExclamation, _
        "Windows Management Instrumentation"
        Exit Sub
        On Error GoTo 0
    End If
    strComputer = "."
    Set objWMI = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    
    Set collIP = objWMI.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
    
    For Each RetVal In collIP
       [B][COLOR="DarkRed"] IP [/COLOR][/B]= RetVal.IPAddress(0)
    Next
    
    SATIR_1 = "KULLANICI/...." & Space(3) & " : " & Application.UserName & Space(2) & " / " & Environ("UserName")
    SATIR_2 = "TARİH/SAAT" & Space(10) & " : " & CStr(Date) & " / " & CStr(Time)
    SATIR_3 = "IP" & Space(29) & " : " &[B][COLOR="DarkRed"] IP[/COLOR][/B]
    SATIR_4 = "İRTİBAT" & Space(8) & " : " & "................."
    MsgBox SATIR_1 & vbCrLf & SATIR_2 & vbCrLf & _
    SATIR_3 & vbCrLf & SATIR_4 & vbCrLf & SATIR_5 & vbCrLf & SATIR_6 & vbCrLf & _
    "==>..............<==", vbInformation, ".................."
    
End Sub

. . .
 
Alternatif;

Kod:
Sub Bilgiver()

SATIR_1 = "KULLANICI/...." & Space(3) & " : " & Application.UserName & Space(2) & " / " & Environ("UserName")
SATIR_2 = "TARİH/SAAT" & Space(10) & " : " & CStr(Date) & " / " & CStr(Time)
SATIR_3 = "IP" & Space(29) & " : " & GetMyLocalIP
SATIR_4 = "İRTİBAT" & Space(8) & " : " & "................."
MsgBox SATIR_1 & vbCrLf & SATIR_2 & vbCrLf & _
SATIR_3 & vbCrLf & SATIR_4 & vbCrLf & SATIR_5 & vbCrLf & SATIR_6 & vbCrLf & _
"==>..............<==", vbInformation, ".................."

End Sub

Function GetMyLocalIP() As String

    'Declaring the necessary variables.
    Dim strComputer     As String
    Dim objWMIService   As Object
    Dim colItems        As Object
    Dim objItem         As Object
    Dim myIPAddress     As String
    
    'Set the computer.
    strComputer = "."
    
    'The root\cimv2 namespace is used to access the Win32_NetworkAdapterConfiguration class.
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    'A select query is used to get a collection of IP addresses from the network adapters that have the property IPEnabled equal to true.
    Set colItems = objWMIService.ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    
    'Loop through all the objects of the collection and return the first non-empty IP.
    For Each objItem In colItems
        If Not IsNull(objItem.IPAddress) Then myIPAddress = Trim(objItem.IPAddress(0))
        Exit For
    Next
    
    'Return the IP string.
    GetMyLocalIP = myIPAddress

End Function
 
Ellerinize sağlık arşivlik kod olmuş.
 
Geri
Üst