save my files as....

Craig AS

New Member
Joined
Mar 6, 2002
Messages
26
hey,

i am writing a macro to save my monthly sale summarys at the end of each month, however, the problem is that i cannot save the files as diffrent names each time, is this possible and if so how? Any help is great, thanx alot

Craig
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
how would you like th efile name to be :

loklk at it like in parts .. or just wack the time on the end never two the same then
 
Upvote 0
On 2002-04-25 10:49, Craig AS wrote:
hey,

i am writing a macro to save my monthly sale summarys at the end of each month, however, the problem is that i cannot save the files as diffrent names each time, is this possible and if so how? Any help is great, thanx alot

Craig

Sure its possible. But what do you want to name them? You can get a name out of a cell and add an extension. For example:

sFileName = ActiveSheet.Range("A1").text & ".xls"
 
Upvote 0
thnx,

i will want to name them the month and then year, eg. april 2001, may 2001...etc

can this still be used with the formula u gave me?
 
Upvote 0
On 2002-04-25 11:20, Craig AS wrote:
thnx,

i will want to name them the month and then year, eg. april 2001, may 2001...etc

can this still be used with the formula u gave me?

Did you want to name them by the current month, or are you doing work on previous months? If it is the current month, do this in VBA: (fname is the variable where the filename string will be stored)<pre/>

fname = MonthName(Month(Now)) & Year(Now)</pre>
If you want to name it according to past
months, you need the name of the month and
year to be extracted from somewhere. Lets
say you keep the date in A1 for each sheet
you are saving, do this:<pre/>

Dim old_date As Date
Dim File_Name as String
old_date = Worksheets("sheet1").Range("A1").Value
File_Name = MonthName(Month(old_date)) & Year(old_date)</pre>
This message was edited by John McGraw on 2002-04-25 13:11
 
Upvote 0
the codes here adre spot on, but weill not cover your request could clash, thus i gave the answer in my posy admitted not code sugget link else <<<<<cannot save the files as diffrent names each time>>> does not answer the quersion...

see what i mean!
 
Upvote 0
hey thnx alot,

but wud i then just have 2 put some thing like

Activeworkbook.save as("fname")?

ne way, i'll give it a go

thnx again
 
Upvote 0
On 2002-04-25 14:37, Craig AS wrote:
hey thnx alot,

but wud i then just have 2 put some thing like

Activeworkbook.save as("fname")?

ne way, i'll give it a go

thnx again

Yes thats correct, except there is no space between save and as. And you dont put quotes around file_name if it is a variable. Otherwise your file will actually
be saved as "fname", literaly.


ActiveWorkbook.Saveas(File_Name)
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,915
Members
448,532
Latest member
9Kimo3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top