![]() |
Saving an excel file using a date
using VB I would like to save a file using the date that is cel d2.
I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You |
Saving an excel file using a date
Option Explicit
sub testme() with activeworkbook .saveas filename:="C:\somepath\reg_" _ & format(.worksheets("sheetnamehere").range("D2").va lue, "mmddyy") _ & ".xls", fileformat:=xlworkbooknormal end with End Sub Ed Davis wrote: using VB I would like to save a file using the date that is cel d2. I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You -- Dave Peterson |
Saving an excel file using a date
Thank You again Dave I will try it.
"Dave Peterson" wrote in message ... Option Explicit sub testme() with activeworkbook .saveas filename:="C:\somepath\reg_" _ & format(.worksheets("sheetnamehere").range("D2").va lue, "mmddyy") _ & ".xls", fileformat:=xlworkbooknormal end with End Sub Ed Davis wrote: using VB I would like to save a file using the date that is cel d2. I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You -- Dave Peterson |
Saving an excel file using a date
I tried this and get a debug error. Option Explicit Sub testme() With ActiveWorkbook .savesas Filename:="sales_" & Format(.Worksheets("31(3)").Range("B17").Value, "mmyyyy") & ".xls", FileFormat:=xlWorkbookNormal End With End Sub "Ed Davis" wrote in message ... Thank You again Dave I will try it. "Dave Peterson" wrote in message ... Option Explicit sub testme() with activeworkbook .saveas filename:="C:\somepath\reg_" _ & format(.worksheets("sheetnamehere").range("D2").va lue, "mmddyy") _ & ".xls", fileformat:=xlworkbooknormal end with End Sub Ed Davis wrote: using VB I would like to save a file using the date that is cel d2. I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You -- Dave Peterson |
Saving an excel file using a date
The first thing I'd change is .savesas to .saveas -- You have too many s's in
that word! If that fixes one problem, but not the whole thing, post back with the error and the line that causes that error. Ed Davis wrote: I tried this and get a debug error. Option Explicit Sub testme() With ActiveWorkbook .savesas Filename:="sales_" & Format(.Worksheets("31(3)").Range("B17").Value, "mmyyyy") & ".xls", FileFormat:=xlWorkbookNormal End With End Sub "Ed Davis" wrote in message ... Thank You again Dave I will try it. "Dave Peterson" wrote in message ... Option Explicit sub testme() with activeworkbook .saveas filename:="C:\somepath\reg_" _ & format(.worksheets("sheetnamehere").range("D2").va lue, "mmddyy") _ & ".xls", fileformat:=xlworkbooknormal end with End Sub Ed Davis wrote: using VB I would like to save a file using the date that is cel d2. I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You -- Dave Peterson -- Dave Peterson |
Saving an excel file using a date
I don't know why I did not check the spelling. But that worked.
Thanks again Dave. "Dave Peterson" wrote in message ... The first thing I'd change is .savesas to .saveas -- You have too many s's in that word! If that fixes one problem, but not the whole thing, post back with the error and the line that causes that error. Ed Davis wrote: I tried this and get a debug error. Option Explicit Sub testme() With ActiveWorkbook .savesas Filename:="sales_" & Format(.Worksheets("31(3)").Range("B17").Value, "mmyyyy") & ".xls", FileFormat:=xlWorkbookNormal End With End Sub "Ed Davis" wrote in message ... Thank You again Dave I will try it. "Dave Peterson" wrote in message ... Option Explicit sub testme() with activeworkbook .saveas filename:="C:\somepath\reg_" _ & format(.worksheets("sheetnamehere").range("D2").va lue, "mmddyy") _ & ".xls", fileformat:=xlworkbooknormal end with End Sub Ed Davis wrote: using VB I would like to save a file using the date that is cel d2. I want to save it in following format "reg_MMDDYY".xls Does anyone know how this can be done? I used to be able to do it in Lotus but have been bashing my mind for the last couple of years trying this in Excel. Thank You -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 04:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com