' ========================================================================================================================
' ____,__, __, ____,_, _, ____ ____,__, ,____,____,
' (-/_|(-| (-| (-|_,(-|\ | (-|__|-/_|( |_/(-|_,(-|__)
' _/ |,_|__,_|__,_|__,_| \|, _|__)/ |,_| \,_|__,_| \,
'
' Copyright 2011 Allen Baker
'
' ------------------------------------------------------------------------------------------------------------------------
' File: M029_Log
' Originator: Allen Baker (2011.03.16 00:38)
' ------------------------------------------------------------------------------------------------------------------------
' $RCSfile$
' $Revision$
' $Date$
' ========================================================================================================================
'
Option Explicit
' ========================================================================================================================
' Description
' This module is for writing one-row messages to the Sheet named "log" if there is one in the current Excel workbook.
' ========================================================================================================================
' =====================================================================================================================
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ Constants ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' =====================================================================================================================
' =====================================================================================================================
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ Module Variables ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' =====================================================================================================================
'
' ==============================================================================================
' keeps track of the last row number that a log message was written to
' ----------------------------------------------------------------------------------------------
Dim mRow As Long
' =====================================================================================================================
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ Public Routines ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' =====================================================================================================================
' ===========================================================================================================
' ===========================================================================================================
' ===========================================================================================================
' This subroutine clears the log sheet and resets mRow to 0.
' -----------------------------------------------------------------------------------------------------------
Public Sub initializeLog()
mRow = 0
If worksheetExists("log") Then
Worksheets("log").Activate
With Worksheets("log")
Cells.Select
Selection.Delete Shift:=xlUp
Cells.Select
Selection.Columns.AutoFit
Range("A1").Select
End With
End If
End Sub
' ===========================================================================================================
' ===========================================================================================================
' ===========================================================================================================
' This subroutine writes a one-row message to the log sheet. Each parameter is written to a seperate column
' in the row; i.e., pS1 is put in column A, pS2 is put in column B, pS3 is put in column C, etc..
'
' param
' pS1 is the string to write into Cells(mRow + 1, 1)
' param (optional)
' pS2 is the string to write into Cells(mRow + 1, 2)
' pS3 is the string to write into Cells(mRow + 1, 3)
' etc.
' -----------------------------------------------------------------------------------------------------------
Public Sub logMsg _
( _
pS1 As String, _
Optional pS2 As String = "", _
Optional pS3 As String = "", _
Optional pS4 As String = "", _
Optional pS5 As String = "", _
Optional pS6 As String = "", _
Optional pS7 As String = "", _
Optional pS8 As String = "", _
Optional pS9 As String = "" _
)
If worksheetExists("log") Then
mRow = mRow + 1
Worksheets("log").Activate
With Worksheets("log")
Cells(mRow, 1).value = pS1
Cells(mRow, 2).value = pS2
Cells(mRow, 3).value = pS3
Cells(mRow, 4).value = pS4
Cells(mRow, 5).value = pS5
Cells(mRow, 6).value = pS6
Cells(mRow, 7).value = pS7
Cells(mRow, 8).value = pS8
Cells(mRow, 9).value = pS9
Cells.Select
Selection.Columns.AutoFit
Range("A1").Select
End With
End If
End Sub
' =====================================================================================================================
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ Private Routines ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' =====================================================================================================================