Macro: How to create a new excefile - named as given in a cell-value

S

Snoopy

Hey guys
You have given me a helping hand on severel occassions, and I hope you
will do it again.

In my excel-file (exmpl): UserWorkBook.xls the UserID is specified in
cell A1 - Exmpl cellvalue A1 is "USER001"
When updating this UserWorkBook.xls I want the macro to create a
backup file - named as USER001BACKUP.xls and savet into a given folder
- expml: USERBACKUP.
The macro only copys all values and formats from
[UserWorkBook.xls]Sheet1! into this backup-file.
If the file USER001BACKUP.xls allready exists - this earlier versjon
should be deleted before saving the new one - or just revise the file
without any visible messages. (I dont knoe whats the easyest way.)

I would be happy if any of you could be nice and spend some minutes on
this one.

Regards Snoopy
 
S

Snoopy

Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value

--
__________________________________
HTH

Bob




Hey guys
You have given me a helping hand on severel occassions, and I hope you
will do it again.
In my excel-file (exmpl): UserWorkBook.xls the UserID is specified in
cell A1 - Exmpl cellvalue A1 is "USER001"
When updating this UserWorkBook.xls I want the macro to create a
backup file - named as USER001BACKUP.xls and savet into a given folder
- expml: USERBACKUP.
The macro only copys all values and formats from
[UserWorkBook.xls]Sheet1! into this backup-file.
If the file USER001BACKUP.xls  allready exists - this earlier versjon
should be deleted before saving the new one - or just revise the file
without any visible messages. (I dont knoe whats the easyest way.)
I would be happy if any of you could be nice and spend some minutes on
this one.
Regards Snoopy– Skjul sitert tekst –

– Vis sitert tekst –

Bob
Thanks a lot :)))
One more question (if I may):
Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value copies the
entire sheet (exactly as I asked) , but I was not very accurat in my
describtion of the problem: I just want the values copied - not the
buttons and macrios plased in the UserWorkBook.xls Sheet1

Are there a similar elegant comand for this as well?

Regards
Snoopy
 
B

Bob Phillips

No, You would have to save it, open it again, paste values, save it and
close it.

--
__________________________________
HTH

Bob

Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value

--
__________________________________
HTH

Bob




Hey guys
You have given me a helping hand on severel occassions, and I hope you
will do it again.
In my excel-file (exmpl): UserWorkBook.xls the UserID is specified in
cell A1 - Exmpl cellvalue A1 is "USER001"
When updating this UserWorkBook.xls I want the macro to create a
backup file - named as USER001BACKUP.xls and savet into a given folder
- expml: USERBACKUP.
The macro only copys all values and formats from
[UserWorkBook.xls]Sheet1! into this backup-file.
If the file USER001BACKUP.xls allready exists - this earlier versjon
should be deleted before saving the new one - or just revise the file
without any visible messages. (I dont knoe whats the easyest way.)
I would be happy if any of you could be nice and spend some minutes on
this one.
Regards Snoopy– Skjul sitert tekst –

– Vis sitert tekst –

Bob
Thanks a lot :)))
One more question (if I may):
Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value copies the
entire sheet (exactly as I asked) , but I was not very accurat in my
describtion of the problem: I just want the values copied - not the
buttons and macrios plased in the UserWorkBook.xls Sheet1

Are there a similar elegant comand for this as well?

Regards
Snoopy
 
S

Snoopy

No, You would have to save it, open it again, paste values, save it and
close it.

--
__________________________________
HTH

Bob


Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value

news:91d056a0-c2ee-4640-afcb-545c2a2f6cd1@y38g2000hsy.googlegroups.com....
Hey guys
You have given me a helping hand on severel occassions, and I hope you
will do it again.
In my excel-file (exmpl): UserWorkBook.xls the UserID is specified in
cell A1 - Exmpl cellvalue A1 is "USER001"
When updating this UserWorkBook.xls I want the macro to create a
backup file - named as USER001BACKUP.xls and savet into a given folder
- expml: USERBACKUP.
The macro only copys all values and formats from
[UserWorkBook.xls]Sheet1! into this backup-file.
If the file USER001BACKUP.xls allready exists - this earlier versjon
should be deleted before saving the new one - or just revise the file
without any visible messages. (I dont knoe whats the easyest way.)
I would be happy if any of you could be nice and spend some minutes on
this one.
Regards Snoopy– Skjul sitert tekst –
– Vis sitert tekst –

Bob
Thanks a lot :)))
One more question (if I may):
Activeworkbook.SaveCopyAs "USERBACKUP\" & Range("A1").Value copies the
entire sheet (exactly as I asked) , but I was not very accurat in my
describtion of the problem: I just want the values copied - not the
buttons and macrios plased in the UserWorkBook.xls Sheet1

Are there a similar elegant comand for this as well?

Regards
Snoopy– Skjul sitert tekst –

– Vis sitert tekst –

Thanks again Bob
It works :) now - big suprise!!!

Regards Snoopy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top