I am facing problem while using Public Sub Workbook_BeforeSave(ByValSaveAsUI As Boolean, Cancel As B

D

deepak kakade

Hi,

I am facing problem while using Public Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

I have use the following code to take back of particular file.

Public Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.SaveCopyAs Filename:="D:\BackupFiles\" & ActiveWorkbook.Name
End Sub

but if i open new workbook this macro does not work in new workbook. I need to re enter the codes in new workbook. Is there any solution on this? please help someone!
 
G

GS

deepak kakade wrote :
Hi,

It means every time I have to add same macro in new workbook?

Basically, YES. However you could put the macro in a template workbook
and create new workbooks based on the template. (Templates are copied
to make the new workbook)
 

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