Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding time to script
Below is my script to send an Excel form via email. It adds the date to the
file name, but I am having trouble getting the time. Any help would be appreciated. Thanks Private Sub CommandButton1_Click() Dim wb As Workbook Dim strdate As String Dim MyArr As Variant MyArr = Sheets("EmailAddresses").Range("a2:a25") strdate = Format(Now, "mm-dd-yy") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdate & " " & strtime & ".xls" .SendMail MyArr, "LOA" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding time to script
Private Sub CommandButton1_Click()
Dim wb As Workbook Dim strdate As String Dim MyArr As Variant MyArr = Sheets("EmailAddresses").Range("a2:a25") strdatetime = Format(Now, "mm-dd-yy hh-mm-ss") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdatetime & ".xls" .SendMail MyArr, "LOA" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- HTH RP (remove nothere from the email address if mailing direct) "JBL" wrote in message ... Below is my script to send an Excel form via email. It adds the date to the file name, but I am having trouble getting the time. Any help would be appreciated. Thanks Private Sub CommandButton1_Click() Dim wb As Workbook Dim strdate As String Dim MyArr As Variant MyArr = Sheets("EmailAddresses").Range("a2:a25") strdate = Format(Now, "mm-dd-yy") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdate & " " & strtime & ".xls" .SendMail MyArr, "LOA" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding time to script
Much appreciated. Thanks
"Bob Phillips" wrote: Private Sub CommandButton1_Click() Dim wb As Workbook Dim strdate As String Dim MyArr As Variant MyArr = Sheets("EmailAddresses").Range("a2:a25") strdatetime = Format(Now, "mm-dd-yy hh-mm-ss") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdatetime & ".xls" .SendMail MyArr, "LOA" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- HTH RP (remove nothere from the email address if mailing direct) "JBL" wrote in message ... Below is my script to send an Excel form via email. It adds the date to the file name, but I am having trouble getting the time. Any help would be appreciated. Thanks Private Sub CommandButton1_Click() Dim wb As Workbook Dim strdate As String Dim MyArr As Variant MyArr = Sheets("EmailAddresses").Range("a2:a25") strdate = Format(Now, "mm-dd-yy") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ThisWorkbook.Name _ & " " & strdate & " " & strtime & ".xls" .SendMail MyArr, "LOA" .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VB script for Current time | Excel Worksheet Functions | |||
Time log adding time from separate sheets | New Users to Excel | |||
Adding time to date-time formatted cell | Excel Discussion (Misc queries) | |||
Excel 2000/XP script to Excel97 script | Excel Programming | |||
Run Time Error 9, Script Out of Range | Excel Programming |