CodeList Nesnesi

CodeList nesnesi kod listesi yönetimi için kullanılır. Oluşturma:

Dim CodeList
Set CodeList = Doc.CreateSObject("CodeList")

Empty / RemoveAll

  • Dönüş Tipi: Void
  • Parametreler: Yok
  • Açıklama: Kod listesini temizler

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.Empty
    Set CodeList = Nothing
End Sub

SetCodeLen

  • Dönüş Tipi: Void
  • Parametreler:
  • - length (Integer): Kod uzunluğu
  • Açıklama: Kod uzunluğunu ayarlar

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.SetCodeLen 10
    Set CodeList = Nothing
End Sub

AddSpace

  • Dönüş Tipi: Void
  • Parametreler: Yok
  • Açıklama: Boş kod ekler

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddSpace
    Set CodeList = Nothing
End Sub

AddCode

  • Dönüş Tipi: Void
  • Parametreler:
  • - code (String): Kod
  • Açıklama: Koda ekler

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddCode "STOK001"
    CodeList.AddCode "STOK002"
    CodeList.AddCode "STOK003"
    Set CodeList = Nothing
End Sub

GetSize

  • Dönüş Tipi: Integer
  • Parametreler: Yok
  • Açıklama: Kod listesi boyutunu döndürür

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddCode "STOK001"
    CodeList.AddCode "STOK002"
    Dim Boyut
    Boyut = CodeList.GetSize()
    Doc.MsgBox "Kod Sayısı: " & Boyut
    Set CodeList = Nothing
End Sub

GetAt

  • Dönüş Tipi: Variant (String)
  • Parametreler:
  • - index (Integer): İndeks
  • Açıklama: İndeks ile kodu döndürür

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddCode "STOK001"
    CodeList.AddCode "STOK002"
    Dim Kod
    Kod = CodeList.GetAt(0)  ' İlk kod
    Doc.MsgBox "Kod: " & Kod
    Set CodeList = Nothing
End Sub

IsInList

  • Dönüş Tipi: Boolean
  • Parametreler:
  • - code (String): Kod
  • Açıklama: Kodun listede olup olmadığını kontrol eder

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddCode "STOK001"
    CodeList.AddCode "STOK002"
    
    If CodeList.IsInList("STOK001") Then
        Doc.MsgBox "Kod listede var"
    Else
        Doc.MsgBox "Kod listede yok"
    End If
    Set CodeList = Nothing
End Sub

Sort

  • Dönüş Tipi: Void
  • Parametreler: Yok
  • Açıklama: Kod listesini sıralar

Örnek Kullanım:

Sub Makro1()
    Dim CodeList
    Set CodeList = Doc.CreateSObject("CodeList")
    CodeList.AddCode "STOK003"
    CodeList.AddCode "STOK001"
    CodeList.AddCode "STOK002"
    CodeList.Sort
    Doc.MsgBox "Kodlar sıralandı"
    Set CodeList = Nothing
End Sub

---