Skip to content

Instantly share code, notes, and snippets.

@chilismaug
Last active September 22, 2022 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilismaug/a1dcf4bc9ee883ce83692ef43c085136 to your computer and use it in GitHub Desktop.
Save chilismaug/a1dcf4bc9ee883ce83692ef43c085136 to your computer and use it in GitHub Desktop.
vba-update-checklist : TDR_OPNCS_BYPHS_N_STAT_RPT_WEB

Implement SubZero, cleanup

  • Declarations, Inits, Drop-ins

    • Option Explicit
    • SubZero: remove/import version with gstrLogPath fix
    • update SubZero prologue constant to use G rather than D or I for WriteLog
    • add WriteLog as Public, not Private
    • Public iLogIndex As Integer
  • Search and destroy

    • replace initial log statement such as "log_run_started" with ####### LOG UP block (initializes loglines index)
    • Remove old log subs and wherever they are invoked, replace with subzero WriteLog calls.
      • clear_log
      • log_message
      • log_run_completed
      • log_run_started
    • look for and replace dangerous ActiveSheet declarations with a qualified declaration ThisWorkbook.Worksheets("Macro")
    • In the refactored log writing calls, change "," parm syntax to be simple & append strings
    • cancel/stop buttons - assure WriteTextLog runs just before bail-out
    • refactor short-circuit If Not statements with no End
    • special case: end_process sub - assure WriteTextLog runs just before bail-out
    • hunt down all exit statements and assure WriteTextLog runs just before bail-out
    • look for MsgBox "Macro completed!" - may need to move the cleanup actions all to bottom just before Excel objects wiped
    • replace hard-coded log-writing instructions such as ActiveSheet.Range("D2").Value - replaced with WriteLog calls
  • Verify logging

    • Central log entry written
    • macro-named folder created for local log
    • 1 local log created per run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment