Save workbook with a name mentioned in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have tried to use explaination from the community, but till know this did
not work.

Can someone advise me on the following?

I want to save a workbook with a refference in a cell, at the moment i use:

Private Sub Workbook_Save()
Dim rng As Range

Set rng = ActiveSheet.Range("M2")

ActiveWorkbook.SaveAs _
Filename:=rng.Value & ".xls", _
FileFormat:=xlWorkbookNormal

End Sub

This is working if i run it manually, but what do i need to do to activate
this when i click on the save buton?

Thanks
 
Hi Gary

i have placed my macro into a Module (name changed to "Workbook_Save)

I have placed your macro into Thisworkbook.

This should be as your described, but it is still not working.

The error i get is: Compile error - Expected Variable or Proceder, not module.

Thanks for your help
 
Back
Top