Search notes:

VBA Module Debug [Common]

option explicit

private debugFile   as integer
private indent      as integer
private fileName_   as string

public sub dbgFileName(fileName as string) ' {
  fileName_ = fileName
end sub ' }

public sub dbg(text as string) ' {

  if not debugEnabled then
     exit sub
  end if

  call startDbg()
  print #debugFile, space(indent) & text
  call endDbg()

end sub ' }

public sub dbgS(text as string) ' {

  if not debugEnabled then
     exit sub
  end if

' indent = indent + 1
  call dbg("{ " & text)
  indent = indent + 2
end sub ' }

public sub dbgE() ' {

  if not debugEnabled then
     exit sub
  end if

  indent = indent - 2
  call dbg("}")
' indent = indent - 1
end sub ' }

function debugEnabled() as boolean ' {

' if environ$("username") = "René" and environ$("computername") = "THINKPAD" then
     debugEnabled = true
' else
'    debugEnabled = false
' end if

end function ' }

private sub startDbg() ' {

  if not debugEnabled then
     exit sub
  end if

  debugFile = freeFile()
' open debugFileName for output as #debugFile
  open fileName_ for append as #debugFile

end sub ' }

private sub endDbg() ' {

  if not debugEnabled then
     exit sub
  end if

  close #debugFile
end sub ' }

Github repository VBAModules, path: /Common/Debug.bas

See also

This module is somewhat superseded by VBA classes for hierarchical debugging.
René's VBA Modules

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759414189, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/modules/Common/Debug(115): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78