TextFile.bas 834 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Attribute VB_GlobalNameSpace = False
  2. Attribute VB_Creatable = False
  3. Attribute VB_PredeclaredId = False
  4. Attribute VB_Exposed = False
  5. Option Compare Database
  6. Option Explicit
  7. ' ** Access Toolbox Module **
  8. ' on 2017-02-28,
  9. ' @author: Olivier Massot
  10. ' V 1.0
  11. ' Text File Object
  12. Private loc_ref As Variant
  13. Private loc_path As String
  14. Property Let path(path As String)
  15. loc_path = path
  16. End Property
  17. Property Get path() As String
  18. path = loc_path
  19. End Property
  20. Public Sub create_file(Optional path As String = "")
  21. Dim ref As Variant
  22. If Len(chemin) > 0 Then loc_path = chemin
  23. loc_ref = FreeFile(1)
  24. Open loc_path For Append Access Write Shared As locRef
  25. End Sub
  26. Public Sub write_line(str As String)
  27. Print #locRef, str
  28. End Sub
  29. Public Sub close_file()
  30. Close #locRef
  31. End Sub
  32. Private Sub class_Terminate()
  33. Close #locRef
  34. End Sub