title: Creating a leave absence system using Excel?
body: <p>I'm totally new to Excel VBA. I am using Microsoft 2003 excel. </p>
  
  <p>What my superior tasked me to do was to create a Leave Management System that tracks down an employee's amount of days left in terms of leave and from there, send an email down to her, her secretary and the employee regarding the status of approved or rejected. </p>
  
  <p>I did try out some codes of VBA.. But I do not know how really the mail sending function works? Do i send the attachment out? Or when i entered some value in the code, it will auto send the whole attachment over? I'm really lost here, thank you!</p>
  
  <pre><code>Sub Mail_sheets()
  Dim MyArr As Variant
  Dim last As Long
  Dim shname As Long
  Dim a As Integer
  Dim Arr() As String
  Dim N As Integer
  Dim strdate As String
  For a = 1 To 253 Step 3
      If ThisWorkbook.Sheets("mail").Cells(1, a).Value = "" Then
          Exit Sub
      End
      Application.ScreenUpdating = False
      last = ThisWorkbook.Sheets("mail").Cells(Rows.Count, _
          a).End(xlUp).Row
      N = 0
      For shname = 1 To last
          N = N + 1
          ReDim Preserve Arr(1 To N)
          Arr(N) = ThisWorkbook.Sheets("mail").Cells(shname, a).Value
      Next shname
      ThisWorkbook.Sheets(Arr).Copy
      strdate = Format(Date, "dd-mm-yy") &amp; " " &amp; _
          Format(Time, "h-mm-ss")
      ActiveWorkbook.SaveAs "Part of " &amp; ThisWorkbook.Name _
          &amp; " " &amp; strdate &amp; ".xls"
      With ThisWorkbook.Sheets("mail")
          MyArr = .Range(.Cells(1, a + 1), .Cells(Rows.Count, _
              a + 1).End(xlUp))
      End With
      ActiveWorkbook.SendMail MyArr, ThisWorkbook.Sheets("mail").Cells(1, a + 2).Value
      ActiveWorkbook.ChangeFileAccess xlReadOnly
      Kill ActiveWorkbook.FullName
      ActiveWorkbook.Close False
      Application.ScreenUpdating = True
  Next a
  End Sub
  </code></pre>