Excel Addin- Processing of data while opening excel files in EXCEL

Excel Addin- Processing of data while opening excel files in EXCEL

Post by UnAwMD » Wed, 27 Sep 2006 23:58:01


HI

while opening any excel files (.xls files) in MS EXCEL.EXE, I need to do
some data existence check in that xls file. How do I do this. Can anybody
shares the brief details.

I tried developing COM Addin using C# but could not get the corresponding
event for opening the exisitng workbook.

Any help would be great and appreciated.

I am using OFFICE 2003 and Visual Studio .Net 2003 on FrameWork v1.1



thanks,
-Ram.
 
 
 

Excel Addin- Processing of data while opening excel files in EXCEL

Post by WEwtRGVubm » Thu, 28 Sep 2006 01:56:02

Hi Ram

I'm not yet a C#-person but it's my understanding that reading VB-code for
C# is rather easy compared with opposite situation.

Below is just a snippet code on how to open a specific workbook and don't
forget to add the reference to the Excel:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim xlApp As New Excel.Application
Dim xlWBook As Excel.Workbook = xlApp.Workbooks.Open("c:\test.xls")

'Add Your code to do the data check here...

'Make Excel and the workbook available for the user.
With xlApp
.Visible = True
.UserControl = True
End With

'Housecleaning
xlWBook = Nothing
xlApp = Nothing

'Force garbage collect
GC.Collect()
GC.WaitForPendingFinalizers()

End Sub

--
With kind regards,
Dennis

 
 
 

Excel Addin- Processing of data while opening excel files in EXCEL

Post by Cindy M » Fri, 29 Sep 2006 16:37:50

Hi =?Utf-8?B?UnAwMDc=?=,

This would certainly be the right approach...

Can you be more specific about "could not get the corresponding event for
opening the workbook"? Do you mean you couldn't find the event?

Cindy Meister
INTER-Solutions, Switzerland
http://www.yqcomputer.com/ (last update Jun 17 2005)
http://www.yqcomputer.com/

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)