I was just thinking if this can be achieved?
Cell A1 has some date, I want the code that can create a copy of the excel file and save it as "PS+thedatein Cell A1".xls
For Example:
If A1=01042012
then the file should get saved as PS01042012
I was just thinking if this can be achieved?
Cell A1 has some date, I want the code that can create a copy of the excel file and save it as "PS+thedatein Cell A1".xls
For Example:
If A1=01042012
then the file should get saved as PS01042012
try this and see if it helps you
Please Login or Register to view this content.
Regards, John55
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
...enjoy -funny parrots-
I'm seeing the below mentioned error message:
Run time error '1004'
Method 'SaveAs' of object_'Workbook' failed.
please help...
hi,
please see http://www.vbaexpress.com/kb/getarticle.php?kb_id=38
Please Login or Register to view this content.
Last edited by john55; 01-04-2012 at 10:52 AM.
Hi John,
The example provided on the mentioned URL is working fine, however, the code provided by you is still showing some error.
I've tried changing the date format as well the location to save the file but no success.
Can you please attach a working example? It will be gr8 for me
Try. I think it will give you an error if cell is in date format only
Please Login or Register to view this content.
Run time error '1004'
Method 'SaveAs' of object_'Workbook' failed.
Getting the above mentioned errror message
Change the file path to the folder's directory address you wish to save. The reason why you're running into the error is because the workbook that you're running the macro from, is a brand new workbook, and since it is not saved it does not have a file path, yet.
FileName = ActiveWorkbook.Path to "C:\Users\test\abc\whatever
Still not working, if possible, please attach a working example.
hi Piggy,
see file attached with JieJen's code, it works for me.
(not sure what it's going wrong there...)
Hey John,
The moment I execute this code - I get a new file called "Book 1".
I want it to have a specific name i.e. PS+the date in Cell A1. The new should get saved and close automatically.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=38
This example is perfect but it is other way round.
I've Date in Cell A1
hi Pigggy,
hope this new one helps you
also see http://www.mrexcel.com/archive/VBA/19609d.htmlPlease Login or Register to view this content.
I'm getting the popup that the file is being saved with the desired name, however, I'm not able to find the file on the mentioned drive.
Where it is getting saved?
hi,
Please test it with a workbook which has a name, not with a new one without name, then add in cell A1 yr date or whatever!
it should be on yr desktop or in My Documents.
Last edited by john55; 01-07-2012 at 03:37 AM.
I have saved the file, macro execution is flaw-less. But it is not generating the file.
Try executing the above mentioned code.
try this test file, format yr cell A1 as text and type yr data as (as an example) 08.jan.2012
hi, thx for rep!
If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes.
hi,
you have nothing in cell b1, I added 11.jan.2012 in cell b1 and pls check the attached file.
Ooops....check cell B2, that is the format - and I wanna save the file to the d: drive
hi again Pigggy!
add a new folder in D (as my example "test1") and try it
Please Login or Register to view this content.
Attached error message that I'm encountering, have created the folder on the d: drive
This is where we started.
Check execution of this macro on your end.
what can I say...
I change yr name as ...se attached file!
You're changing the format of the cell, from date to text, thats why you are able to execute it.
I cannot change the format of the cell, it has to be date only.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks