LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 148
Default how to get a macro to work

Hi There,

I have received some info through this posting, but it is not working how i
want to.
Hoppefully someone can help me further?

I have a Macro in a Module (Workbook_save)

Sub Workbook_Save()
Dim rng As Range

Set rng = ActiveSheet.Range("M2")

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

End Sub

And a macro to start up the above in This workbook:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Call Workbook_Save
Cancel = True
End Sub

But for some reason it is not saving the file as supose to do, i get the
error:
Compile Error - Expected variable or Proceder, not module

How can tell me what this is and how to fix?

Thanks
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro for work book Daniel Charts and Charting in Excel 1 August 12th 07 12:04 AM
How to work with macro in background Jared Excel Discussion (Misc queries) 2 August 14th 06 04:49 AM
Macro doesn't work but recording it does. Rob Excel Discussion (Misc queries) 2 May 24th 05 06:43 AM
Why does the macro not work? Xanadude Excel Worksheet Functions 4 April 24th 05 09:06 PM
how do you get (end down) to work in a macro? lcx2 Excel Worksheet Functions 1 March 24th 05 08:15 AM


All times are GMT +1. The time now is 06:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"