Check Source Availability

| Wawan | visual basic

Masih diseputar Vba-Excel, *mindahin semua method di personal xls ke blog :P*, fungsi berikut ini bertugas mengecek apakah sebuah workbook yg kita butuhkan sudah terbuka atau belum, biasanya fungsi ini di ikuti dg makro untuk membuka workbook yg dibutuhkan kalau workbook tadi belum terbuka.

'Name: CheckSourceAvailability
'Purpose: Mengecek apakah workbook yg kita
'     butuhkan sudah terbuka atau belum
'Input: Nama dari workbook yg ingin di cek keberadaannya
'Output: Status keberadaannya
 
Public Function CheckSourceAvailability(sWorkBook As String) _
  As Boolean
    Dim wb As Workbook, bResult As Boolean
    bResult = False
    For Each wb In Application.Workbooks
        If InStr(LCase(wb.Name), LCase(sWorkBook)) > 0 Then
            bResult = True
            Exit For
        End If
    Next wb
    CheckSourceAvailability = bResult
End Function

Semoga berguna buat seseorang :razz:

No comments yet.

feel free to leave a comment

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs are automatically generated. Off-topic or inappropriate comments will be edited or deleted. Email addresses will never be published. Keep it PG-13 people!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

All fields marked with " * " are required.