![]() |
Picking up Date formats for use in Filenames, Etc.
I need to know how to use dates as information in files using VBA. I know
the dates are returned as a serial number and the time is the fraction of same. The formatting of the cell shows the date as you request it to be. When I try to pick up the date in the format shown for use elsewhere I always get the number and not the format. Can I convert the information to text somehow? I have tried various methods and none have succeeded yet. How do I convert the date into the format that is shown in the cell and use it elsewhere, for example, in a filename? |
Picking up Date formats for use in Filenames, Etc.
Pat,
Dim strName as String strName = ActiveCell.Text ' beware of "/" or strName = Format$(ActiveCell.Value,"mmddyyyy") ActiveWorkbook.SaveAs FileName:="Mush" & strName '----------------------- Jim Cone San Francisco, USA "PatQuinn52" wrote in message I need to know how to use dates as information in files using VBA. I know the dates are returned as a serial number and the time is the fraction of same. The formatting of the cell shows the date as you request it to be. When I try to pick up the date in the format shown for use elsewhere I always get the number and not the format. Can I convert the information to text somehow? I have tried various methods and none have succeeded yet. How do I convert the date into the format that is shown in the cell and use it elsewhere, for example, in a filename? |
Picking up Date formats for use in Filenames, Etc.
Thank You. This worked perfectly. I know not to use the "/" character but
thanks for the warning. "Jim Cone" wrote: Pat, Dim strName as String strName = ActiveCell.Text ' beware of "/" or strName = Format$(ActiveCell.Value,"mmddyyyy") ActiveWorkbook.SaveAs FileName:="Mush" & strName '----------------------- Jim Cone San Francisco, USA "PatQuinn52" wrote in message I need to know how to use dates as information in files using VBA. I know the dates are returned as a serial number and the time is the fraction of same. The formatting of the cell shows the date as you request it to be. When I try to pick up the date in the format shown for use elsewhere I always get the number and not the format. Can I convert the information to text somehow? I have tried various methods and none have succeeded yet. How do I convert the date into the format that is shown in the cell and use it elsewhere, for example, in a filename? |
All times are GMT +1. The time now is 11:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com