Convert a date to remove slashes
Posted on 2005-04-20
I want to save an excel file including the date range selected by two combo boxes on a form. The code looks like this:
xls.SaveAs "j:\tracking programs\excel_data\lineobservation " & cbofrom.value & "to " & cboto.value & ".xls"
Problem is, the dates stored in the drop downs include slashes, and those slashes cannot be in the name of the file. How can I convert the dates to the mm-dd-yyyy format? I was thinking something like...
dim datefrom as string
dim dateto as string
datefrom = some-function-that-I-dont-know(cbofrom, "dd-mm-yyyy")
dateto = some-function-that-I-dont-know(cboto, "dd-mm-yyyy")
xls.SaveAs "j:\tracking programs\excel_data\lineobservation " & datefrom & "to " & dateto & ".xls"
Thanks for the assistance!