Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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. Oldjay wrote: 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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date format
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 " wrote: 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. Oldjay wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
permanent conversion of 1904 date format to 1900 date format | Excel Worksheet Functions | |||
Convert date + time text format to date format | Excel Worksheet Functions | |||
Excel 2000 date format cannot be set to Australian date format | Excel Discussion (Misc queries) | |||
code to convert date from TEXT format (03-02) to DATE format (200203) | Excel Programming | |||
Change a date in text format xx.xx.20xx to a recognised date format | Excel Programming |