Macro - Deleting.

D

Dolores

I am able to modify macro, but I cannot create one from scratch. With that
being said, I would like to create a macro that would delete a workbook. If
this is possible can someone give me the codes that need to be used.

Thanks,
 
H

Harald Staff

Hi

It's not that hard. You type "sub " and a unique name in a module and hit
Enter -and there's the macro.
Problem is to make it do reasonable things. To delete a workbook saved on
file, type something like

Sub Kill()
Kill "C:\Temp\Book1.xls"
End Sub

assuming that you want to delete Book1.xls stored in C:\Temp and that it is
not in use at the time.

HTH. Best wishes Harald
 
D

Dolores

Thanks Harald. This was very helpful

Harald Staff said:
Hi

It's not that hard. You type "sub " and a unique name in a module and hit
Enter -and there's the macro.
Problem is to make it do reasonable things. To delete a workbook saved on
file, type something like

Sub Kill()
Kill "C:\Temp\Book1.xls"
End Sub

assuming that you want to delete Book1.xls stored in C:\Temp and that it is
not in use at the time.

HTH. Best wishes Harald
 
N

NgS

Hi Harald,

My excel is 2007 and VB is 6.5. i tried, but encounter "can't execute code
in break mode" error.

Cheers
 
Top