Date format
Get error 1004 when it tries to save "JobSave" who's value is
"C:\My Documents\1234 Jonn Vandiver 10-2-2006"
Here is the entire macro
oldjay
Private Sub CommandButton4_Click() 'Save time sheet
Dim jobname As String
Dim jobemployee As String
Dim Jobdate As String
Dim jobnumber As String
Dim jobsave As String
Jobdate = Range("D7").Value
Jobdate = Month(Jobdate) & "-" & Day(Jobdate) & "-" &
Year(Jobdate)
jobname = Range("D4")
jobemployee = Range("D2")
jobnumber = Range("D5")
jobnumber = InputBox("Please enter TIME SHEET file name to
save", " Process Technology", "C:\My Documents\" & jobnumber + " " +
jobemployee + " " + (Jobdate))
jobsave = jobnumber & ".XLS"
If jobnumber = "" Then
Range("D1").Select
Range("D3").Select
Else
ActiveWorkbook.SaveAs Filename:=jobsave
ActiveWorkbook.Close
Windows("Process Tech Time Sheet Database.XLS").Activate
Range("D1").Select
Range("D3").Select
End If
End Sub
" wrote:
Add this to your code and use your code as posted.
Dim Jobdate As String
Jobdate = Range("D7").Value
Jobdate = Month(Jobdate) & "-" & Day(Jobdate) & "-" & Year(Jobdate)
Oldjay wrote:
I put the following
jobnumber = InputBox("Please enter TIME SHEET file name to
save", " Process Technology", "C:\My Documents\" & jobnumber + " " +
jobemployee + " " + Month(Jobdate) & "-" & Day(jobdate) & "-" & year(jobdate)
I get a compile error
" wrote:
Try Month(Jobdate) & "-" & Day(jobdate) & "-" & year(jobdate)
Alan
Oldjay wrote:
I am trying to save a file with the date in some other format other than
10/3/06
as this will not allow me to save because of the forward slashs. It tried
changing the format in the input cell but still reverts to the forward slashes
jobdate = Range("D7")
jobnumber = InputBox("Please enter TIME SHEET file name to save", " Process
Technology", "C:\My Documents\" & jobnumber + " " + jobemployee + " " +
jobdate)
Thanks in advance
oldjay
|