Option Explicit
Sub testme01()
Dim strComputer As String
Dim objWMIService As Object
Dim colAdapters As Object
Dim objAdapter As Object
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objAdapter In colAdapters
'MsgBox "Physical address: " & objAdapter.MACAddress
Sheets("SINAMA").Select
[a1] = "Physical address: "
[a2] = objAdapter.MACAddress
Columns("a").AutoFit
Next objAdapter
End Sub
'____________________________________________________________________
Sub auto_open()
Static HATA As Integer
Dim KULLANICI As Long
Call testme01
On Error GoTo HATALI_GİRİŞ
Application.Visible = False
With Sheets("SINAMA").Range("H1:H100")
KULLANICI = .Find(What:=Cells(2, 1).Value, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase _
:=True, SearchFormat:=False).Row
End With
If KULLANICI = 0 Then GoTo HATALI_GİRİŞ
MsgBox "Sisteme girişiniz onaylanmıştır.", vbInformation, "HOŞGELDİNİZ "
Application.Visible = True
Exit Sub
HATALI_GİRİŞ:
MsgBox "Bu bilgisayarda , bu dosyayı çalıştırmaya yetkiniz yoktur." _
& Chr(10) & "Lütfen sistem yöneticisiyle iletişime geçiniz." _
& Chr(10) & ".........", vbCritical, "DİKKAT !"
HATA = 1
Application.DisplayAlerts = False
If HATA = 1 Then Application.Quit
End Sub