Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default adding before save so it works every time excel opens and with any workbook

I'm trying to implement a App_WorkbookBeforeSave bit of code, but I don't
understand how to get it to work for any open workbook and have it work
anytime excel is opened.

Cheers!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default adding before save so it works every time excel opens and with any

If you are trying to run the event from Workbook B the code needs to be in
Wbk B.

However, once you start the code you can you can make things happen to other
workbooks:


With Workbooks("A")
.Sheets("XXX").Range("A1")=5
.close True
End With
Close true
end sub

This will change then Save and Close Wbk A, then Save and Close ThisWorkbook.

"Job" wrote:

I'm trying to implement a App_WorkbookBeforeSave bit of code, but I don't
understand how to get it to work for any open workbook and have it work
anytime excel is opened.

Cheers!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default adding before save so it works every time excel opens and with any

But, it is not possible to have the code in the personal.xls or some other
place so that the code could be run anytime Excel is open and on any
workbook?


"gocush" /delete wrote in message
...
If you are trying to run the event from Workbook B the code needs to be in
Wbk B.

However, once you start the code you can you can make things happen to
other
workbooks:


With Workbooks("A")
.Sheets("XXX").Range("A1")=5
.close True
End With
Close true
end sub

This will change then Save and Close Wbk A, then Save and Close
ThisWorkbook.

"Job" wrote:

I'm trying to implement a App_WorkbookBeforeSave bit of code, but I don't
understand how to get it to work for any open workbook and have it work
anytime excel is opened.

Cheers!





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default adding before save so it works every time excel opens and with

To my knowledge the Workbook_BeforeSave event has to be in the ThisWorkbook
module of each workbook that you want it to apply to.

However, I think you would work around this by:
Not having a Workbook_BeforeSave event.
Instead in your Personal.xls have a macro something like:

Sub SaveMyFile()
'Enter your Code to do stuff before saving
ThisWorkbook.Save
End Sub

I am not sure if you can set a shortcut key to a macro in Personal.xls but I
think you can. If so, go to Tools/Macros/Macro select this macro above
/Options and enter s. This will direct the built-in Ctrl+s to this
procedure rather than just the normal Save.

Keep in mind that doing the above will cause this to happen any time you use
Excel. Are you sure you want that?

"Job" wrote:

But, it is not possible to have the code in the personal.xls or some other
place so that the code could be run anytime Excel is open and on any
workbook?


"gocush" /delete wrote in message
...
If you are trying to run the event from Workbook B the code needs to be in
Wbk B.

However, once you start the code you can you can make things happen to
other
workbooks:


With Workbooks("A")
.Sheets("XXX").Range("A1")=5
.close True
End With
Close true
end sub

This will change then Save and Close Wbk A, then Save and Close
ThisWorkbook.

"Job" wrote:

I'm trying to implement a App_WorkbookBeforeSave bit of code, but I don't
understand how to get it to work for any open workbook and have it work
anytime excel is opened.

Cheers!






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
Forgot to save a workbook after adding additional info Susan Excel Discussion (Misc queries) 3 January 12th 08 04:42 AM
when opening an Excel Workbook, another blank workbook also opens Gord Dibben Excel Discussion (Misc queries) 0 October 12th 07 09:49 PM
when opening an Excel Workbook, another blank workbook also opens spmu Excel Discussion (Misc queries) 0 October 12th 07 01:46 PM
Personal workbook opens when Excel opens SheriTingle Excel Discussion (Misc queries) 2 March 30th 05 12:22 AM
Excel Workbook opens after a very very long time Excel Worksheet Functions 2 December 18th 04 11:15 AM


All times are GMT +1. The time now is 04:47 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"