Default date in a UserForm box
Thanks Harald.
Ok. I see what you're saying. I agree. Translate the user input to the
desired format to be printed. That makes much more sense.
So, here's what I'm ultimately trying to do:
The user enters the date, or accepts the default date (which I have set
up already). When the user hits OK, this date is then entered into the
range name Current_Date.
I have that part done, and it works ok. It's adjusting the date format
as it is entered into that range.
Ok... Now, what I need help with is adding the code that will do a
Save-As, and use that date as part of the name. However, I want a
prefix to the date. Example: if the date entered into the range is
12/27/05, then I want the file name to be Staging List 12-27-05.xls
I've previously been helped with doing a Save-As, doing a similar thing
with a different workbook, but with the NOW date from the computer
clock. The difference now is that there are times when this file will
be created after missing a couple days of enteries. So, the actual
current date the file will be save as may not be today. Today might be
the 27th, but they might be working on data from the 23rd. So, even
though it may be the 27th, they might be saving a file Staging List
12-23-05
So, that's why I want the macro to read the range name Current_Date to
get the date part of the new file name that will be saved. Hope that
makes sense.
Here's the code I was given before that only deals with using NOW to
get the date part of the file name.
ActiveWorkbook.SaveAs _
Filename:="Staging List " & Format(Now, "mm-dd-yy") & ".xls", _
FileFormat:=xlWorkbookNormal
I tried playing around with this today, and couldn't find a way to
replace Now with the range name Current_Date. Something in the nature
of
Filename:="Staging List " & Format(Current_Date, "mm-dd-yy") &
".xls", _
I've tried adding quotes, parenthesis, etc. No luck.
Hope you can help.
Thanks,
J.O.
Oh, I entered this problem as a new topic this morning. But, I don't
think this group was working right. I never saw it posted, and the
latest postings were from the 26th. So, if it should ever pop up as a
new topic..... sorry for the redundancy.
|