Posts by waddlek

    Kholid,
    This should work...
    ...Place this code in a Module
    'Code Start
    Option Explicit
    Declare Function GetComputerName& Lib "kernel32" _
    Alias "GetComputerNameA" (ByVal lbbuffer As String, nsize As Long)
    Function ReturnName()
    Dim z As String * 64
    Call GetComputerName(z, 64)
    ReturnName = z
    End Function


    Sub WhatIsMyComputerName()
    Dim CpuName As String
    Application.DisplayAlerts = False
    CpuName = Left(ReturnName(), 11)
    Range("A1").Value = CpuName
    End Sub
    'Code End


    Place this code in the "ThisWorkBook" Module...


    'Code Start
    Option Explicit
    Private Sub Workbook_Open()
    Dim CpuName As String
    Application.DisplayAlerts = False
    CpuName = Left(ReturnName(), 11)

    If CpuName <> "DEO-C7OLZGZ" Then
    ActiveWorkbook.Close
    End If
    Application.DisplayAlerts = True
    End Sub
    'Code End


    You will need to run the WhatIsMyComputerName Sub to find your computer name, then change line...
    If CpuName <> "DEO-C7OLZGZ" Then
    in the Private Sub Workbook_Open() to match your computer name.