Bilgisayar Adını Öğren - Microsoft Excel


Bilgisayar adını mesaj olarak gösteren VBA kodudur.

Kod


Option Explicit

Private Declare Function GetComputerNameA _
    Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function BilgisayarAdiniOgren() As String
    Dim kullaniciAdi As String * 255
    
    Call GetComputerNameA(kullaniciAdi, 255)
    BilgisayarAdiniOgren = Left$(kullaniciAdi, InStr(kullaniciAdi, Chr$(0)) - 1)
    
    MsgBox BilgisayarAdiniOgren
End Function

Etiketler
microsoft excel