Public Sub CekWbkInUse(Optional bState As Boolean = False)
    Dim sFile As String
    sFile = "D:\lib_links.xlsx"

    'cara 1 :
    Dim wbkF As Workbook
    Set wbkF = Workbooks.Open(sFile, 2)
    If wbkF.ReadOnly Then
        Debug.Print "cara 1 : wbk readonly", "Sedang dipakai user lain"
    Else
        Debug.Print "cara 1 : wbk readonly", "Tidak ada yang pakai"
    End If
    wbkF.Close False

    'cara 2 :
    Dim iFile As Integer
    Err.Clear
    On Error Resume Next
    iFile = FreeFile
    Open sFile For Binary Access Read Lock Read As iFile: Close iFile
    If Err.Number <> 0 Then
        Debug.Print "cara 2 : open iofile", "Sedang dipakai user lain"
    Else
        Debug.Print "cara 2 : open iofile", "Tidak ada yang pakai"
    End If
    Err.Clear
    On Error GoTo 0

    'cara 3 :
    Dim sFBackup As String
    Err.Clear
    On Error Resume Next
    sFBackup = sFile & ".kid"
    FileCopy sFile, sFBackup
    Kill sFile
    If Err.Number <> 0 Then
        Debug.Print "cara 3 : save copy delete", "Sedang dipakai user lain"
    Else
        FileCopy sFBackup, sFile
        Debug.Print "cara 3 : save copy delete", "Tidak ada yang pakai"
    End If
    Kill sFBackup
    Err.Clear
    On Error GoTo 0
End Sub

On Wed, Jan 30, 2019 at 7:37 AM Tio Ali [email protected]
[belajar-excel] <[email protected]> wrote:

>
>
> Salqm Bexceller
> Saya mau cek file apakah sedang open atau tidak. Kalau file itu tutup,
> saya buka untuk digunakan. Yg saya tahu selama ini adalah dgn coba cek
> apakah file itu readonly atau tidak. Kalau tidak readoonly berarti file
> tutup. Tapi itu akan jadi masalah kalau file itu sudah besar kapasitasnya
> sehingga jadi lama bukanya.
> Saya dengar ada cara lain yaitu dengan cara delete file itu. Kalau error
> berarti file itu open
> Yg ditanyakan bagaimana teknis delete file itu karena file itu justru file
> yang kita butuhkan ?
>
> Terima kasih.
> Tio
>
>
>
> _
> ------------------------------
> Reply via web post
> <https://groups.yahoo.com/neo/groups/belajar-excel/conversations/messages/45197;_ylc=X3oDMTJybTRwZW9hBF9TAzk3MzU5NzE0BGdycElkAzIwNjI3Njc4BGdycHNwSWQDMTcwODI5ODgyMQRtc2dJZAM0NTE5NwRzZWMDZnRyBHNsawNycGx5BHN0aW1lAzE1NDg3Mjc0ODc-?act=reply&messageNum=45197>
> • Reply to sender
> <[email protected]?subject=Re%3A%20%5Bbelajar-excel%5D%20Macro%20untuk%20mengambil%20Serial%20Number%20Komputer>
> • Reply to group
> <[email protected]?subject=Re%3A%20%5Bbelajar-excel%5D%20Macro%20untuk%20mengambil%20Serial%20Number%20Komputer>
>
> s
> <https://groups.yahoo.com/neo/groups/belajar-excel/conversations/topics/45164;_ylc=X3oDMTM3aTc0Ym5oBF9TAzk3MzU5NzE0BGdycElkAzIwNjI3Njc4BGdycHNwSWQDMTcwODI5ODgyMQRtc2dJZAM0NTE5NwRzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzE1NDg3Mjc0ODcEdHBjSWQDNDUxNjQ->
>
> ------------------------------
> Have you tried the highest rated email app? <https://yho.com/1wwmgg>
> With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email
> app on the market. What are you waiting for? Now you can access all your
> inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email
> again with 1000GB of free cloud storage.
> ------------------------------
> ============================================================
> Pojok Lowongan Kerja yang disediakan milis :
>
> http://milis-belajar-excel.1048464.n5.nabble.com/Pojok-Lowongan-Kerja-f5725753.html
> *** Posting lowongan kerja : ke link tersebut dan klik New Topic
> ============================================================
> bergabung ke milis (subscribe), kirim mail kosong ke:
> [email protected]
> posting ke milis, kirimkan ke: [email protected]
> berkunjung ke web milis :
> http://tech.groups.yahoo.com/group/belajar-excel/messages
> melihat file archive / mendownload lampiran :
> http://www.mail-archive.com/[email protected]/
> atau (sejak 25-Apr-2011) bisa juga di :
> http://milis-belajar-excel.1048464.n5.nabble.com/
> menghubungi moderators & owners: [email protected]
> keluar dari membership milis (UnSubscribe), kirim mail kosong ke :
> [email protected]
> ---------------------------------------------------------------------
> Visit Your Group
> <https://groups.yahoo.com/neo/groups/belajar-excel/info;_ylc=X3oDMTJmNDU3ZHA5BF9TAzk3MzU5NzE0BGdycElkAzIwNjI3Njc4BGdycHNwSWQDMTcwODI5ODgyMQRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzE1NDg3Mjc0ODc->
>
>
> [image: Yahoo! Groups]
> <https://groups.yahoo.com/neo;_ylc=X3oDMTJldTB1NzBhBF9TAzk3NDc2NTkwBGdycElkAzIwNjI3Njc4BGdycHNwSWQDMTcwODI5ODgyMQRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTU0ODcyNzQ4Nw-->
> • Privacy <https://info.yahoo.com/privacy/us/yahoo/groups/details..html> •
> Unsubscribe
> <[email protected]?subject=Unsubscribe> • Terms
> of Use <https://info.yahoo.com/legal/us/yahoo/utos/terms/>
>
> SPONSORED LINKS
> .
>
> 
>

Kirim email ke