Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J_J J_J is offline
external usenet poster
 
Posts: 58
Default Help needed with this autosave macro problem

Hi,

My whole intention is to close the active workbook without beeing prompth by
Windows "do you wanna save the changes....". But unfortunately when I use
the below code I am getting a Compile error with the msgbox
"Procedure declaration does not match description or event procedure having
the same name".
Hope someone can help me to correct this.

--------
Private Sub Workbook_BeforeClose()
ActiveWorkbook.Save
End Sub
--------

Regards
J_J



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Help needed with this autosave macro problem

try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub

Patrick Molloy
Microsoft Excel MVP

"J_J" wrote:

Hi,

My whole intention is to close the active workbook without beeing prompth by
Windows "do you wanna save the changes....". But unfortunately when I use
the below code I am getting a Compile error with the msgbox
"Procedure declaration does not match description or event procedure having
the same name".
Hope someone can help me to correct this.

--------
Private Sub Workbook_BeforeClose()
ActiveWorkbook.Save
End Sub
--------

Regards
J_J




  #3   Report Post  
Posted to microsoft.public.excel.programming
J_J J_J is offline
external usenet poster
 
Posts: 58
Default Help needed with this autosave macro problem

Ahaa!....
So the trick was to have "cancel as boolean"
Thanks Patrick.
That did it!.
J_J


"Patrick Molloy" wrote in message
...
try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub

Patrick Molloy
Microsoft Excel MVP

"J_J" wrote:

Hi,

My whole intention is to close the active workbook without beeing

prompth by
Windows "do you wanna save the changes....". But unfortunately when I

use
the below code I am getting a Compile error with the msgbox
"Procedure declaration does not match description or event procedure

having
the same name".
Hope someone can help me to correct this.

--------
Private Sub Workbook_BeforeClose()
ActiveWorkbook.Save
End Sub
--------

Regards
J_J






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Help needed with this autosave macro problem

Sometimes, it's better to be lazy.

If you used those dropdowns at the top of the code window in the VBE, then
you'll get the correct name/syntax for those builtin events.

J_J wrote:

Ahaa!....
So the trick was to have "cancel as boolean"
Thanks Patrick.
That did it!.
J_J

"Patrick Molloy" wrote in message
...
try

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub

Patrick Molloy
Microsoft Excel MVP

"J_J" wrote:

Hi,

My whole intention is to close the active workbook without beeing

prompth by
Windows "do you wanna save the changes....". But unfortunately when I

use
the below code I am getting a Compile error with the msgbox
"Procedure declaration does not match description or event procedure

having
the same name".
Hope someone can help me to correct this.

--------
Private Sub Workbook_BeforeClose()
ActiveWorkbook.Save
End Sub
--------

Regards
J_J





--

Dave Peterson
Reply
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
AutoSave Macro? Ozzieo2000 Excel Discussion (Misc queries) 1 August 1st 07 09:25 PM
autosave macro excel Philippe B. Excel Discussion (Misc queries) 3 September 22nd 06 07:41 PM
Problem with Autosave Brian Clarke Excel Discussion (Misc queries) 2 May 12th 06 01:51 PM
Opened Autosave but when closing workbook Autosave closes itself Ken Excel Worksheet Functions 0 October 29th 05 05:11 PM
AutoSave code problem TC[_6_] Excel Programming 2 August 25th 04 05:27 AM


All times are GMT +1. The time now is 05:13 PM.

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"