Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tj tj is offline
external usenet poster
 
Posts: 71
Default Save in VBA?

Hi,

Is there any way I can override the Save in VBA app in Excel?
I meant..when user clicks the save button, I would like to have run
my own business logic, and then save the excel file.

If you know, please share it.

Thanks,

  #2   Report Post  
Posted to microsoft.public.excel.programming
tj tj is offline
external usenet poster
 
Posts: 71
Default Save in VBA?

Sorry,

That's not what I wanted to ask..
Actually, I can easily do something thi via BeforeSave event...

What I would like to ask is that...
Once I create .NET standard window .form app....
I am going to load the excel file that is hosted by .NET
In the .NET .form app, is there any way I can catch the Save event?..

I have to try..but I guess .....Excel object may provide some event property
for that......Hum...Anyone?

Also, if I want to create an independent .NET window form app that works
with any version of Excel, I think I have to use late-biding ..right?...
Once I reference the any specific dll for the Excel, then, different version
of excel may not work...

Thanks,



"TJ" wrote:

Hi,

Is there any way I can override the Save in VBA app in Excel?
I meant..when user clicks the save button, I would like to have run
my own business logic, and then save the excel file.

If you know, please share it.

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Save in VBA?

To catch events for all open workbooks, you need to use Application
Level events. In a class, use code like

Option Explicit

Private WithEvents XLApp As Excel.Application

Private Sub Class_Initialize()
Set XLApp = Application
End Sub

Private Sub XLApp_WorkbookBeforeSave(ByVal Wb As Workbook, _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
Debug.Print Wb.Name
End Sub

The terminology will be different in NET, but the concept is the same.
See http://www.cpearson.com/excel/AppEvent.aspx for a discussion of
application events. This page is geared toward VB6/VBA, but it should
be very easy transliterate to NET.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Mon, 27 Oct 2008 18:12:00 -0700, TJ
wrote:

Sorry,

That's not what I wanted to ask..
Actually, I can easily do something thi via BeforeSave event...

What I would like to ask is that...
Once I create .NET standard window .form app....
I am going to load the excel file that is hosted by .NET
In the .NET .form app, is there any way I can catch the Save event?..

I have to try..but I guess .....Excel object may provide some event property
for that......Hum...Anyone?

Also, if I want to create an independent .NET window form app that works
with any version of Excel, I think I have to use late-biding ..right?...
Once I reference the any specific dll for the Excel, then, different version
of excel may not work...

Thanks,



"TJ" wrote:

Hi,

Is there any way I can override the Save in VBA app in Excel?
I meant..when user clicks the save button, I would like to have run
my own business logic, and then save the excel file.

If you know, please share it.

Thanks,

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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Disable save, save as, but allow save via command button TimN Excel Programming 10 September 1st 06 07:05 PM
How to diasble save and save as menu but allow a save button hon123456 Excel Programming 1 June 12th 06 09:50 AM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM


All times are GMT +1. The time now is 04:24 PM.

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

About Us

"It's about Microsoft Excel"