Hi there,
I have the following program:
Private Sub CommandButton2_Click()
FileCopy "C:\RC_development\input\Large_project route card.xlsm", "C:\RC_development\output\newroutcard_LP.xlsm" + VBA.Strings.Format(Now, "mm-dd-yyyy")
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
' File filters
Filter = "Excel Files (*.xls),*.xls," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
' Default Filter to *.*
FilterIndex = 3
' Set Dialog Caption
Title = "Select a File to Open"
' Select Start Drive & Path
ChDrive ("C")
ChDir ("C:\RC_development\output\")
With Application
' Set File Name to selected File
Filename = .GetOpenFilename(Filter, FilterIndex, Title)
' Reset Start Drive/Path
ChDrive (Left(.DefaultFilePath, 1))
ChDir (.DefaultFilePath)
End With
' Exit on Cancel
If Filename = False Then
MsgBox "No file was selected."
Exit Sub
End If
' Open File
Workbooks.Open Filename
MsgBox Filename, vbInformation, "File Opened" ' This can be removed
End Sub
I will like to know how can i add the current time as well as the current date (which is already included in the code above - line 2) to the file that i am pasting by this code.
Bookmarks