Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JbL JbL is offline
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JbL JbL is offline
external usenet poster
 
Posts: 17
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB script for Current time [email protected] Excel Worksheet Functions 2 June 1st 09 08:55 PM
Time log adding time from separate sheets teastman New Users to Excel 1 December 31st 05 04:14 PM
Adding time to date-time formatted cell tawtrey(remove this )@pacificfoods.com Excel Discussion (Misc queries) 4 August 12th 05 10:53 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM
Run Time Error 9, Script Out of Range Jeff Marshall[_2_] Excel Programming 1 October 2nd 03 01:50 AM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"