Date format

G

Guest

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
 
G

Guest

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
 
A

acampbell012

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)
 
G

Guest

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
 
A

acampbell012

On my machine it is breaking on the line:

ActiveWorkbook.SaveAs Filename:=jobsave

"C:\My Documents" directory does not exist on my computer. When I
change jobnumber to point to the temp directory, your macro works.
Does this directory exist on your computer? Will it exist on user's
computers? There are other method of pointing to the My Documents
folder on a given computer.

jobnumber = InputBox("Please enter TIME SHEET file name to
save", " Process Technology", "C:\Temp\" & jobnumber + " " +
jobemployee + " " + (Jobdate))

I also got an error due to JobDate being set as a string variable. Dim
as Variant should fix that.
 
G

Guest

You are right - I should not have used "C:\. I always assumed that "My
Documents" was in the C drive. Dummy! All I had to do is look in the folder
tree to see that.

thanks

oldjay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top