Workbook properties code in the xla addin
On Apr 22, 2:26*pm, Javed wrote:
On Apr 22, 2:11*pm, Javed wrote:
On Apr 22, 1:47*pm, Subodh wrote:
I have to make code applicable to the workbook.
Like workbook_beforeprint code.
Now, after i have made the code work well,
*i want to save the workbook as an addin
so that the code that i have written will be applicable to all
the workbook that will be open after the addin is loaded.
Is there any tips for that
Thanks in advance.
You can use application level event application_workbookbeforeprint(Wb
As Workbook, Cancel As Boolean).For this you have to use class
mdule.Can get the details from Microsoft Site.If you need I can give
the link after a while.
The link ishttp://www.tek-tips.com/faqs.cfm?fid=4195
Thanks Javed.
I tried the link
But it didn't worked.
I am using excel 2007 and XP
This is what i did
Made a new microsoft excel file (Macro Enabled)
Inserted a class module
Pasted following code in the class module
Public WithEvents xlapp as Application
Public Sub xlapp_WorkbookOpen(ByVal Wb As Workbook)
MsgBox " Testing Trap Events! "
End Sub
Named the class module as ClsAppEvents (Don't know if it was needed as
i think these names don't matter)
Again, I made a new module file (standard) renamed it as TrapAppEvents
and typed the following code in it
Public xlApplication As New ClsAppEvents
Public Sub TrapApplicationEvents()
Set xlApplication.xlapp = Application
End Sub
Saved it and kept it open
Now,I expected that if i open new excel files then the message should
trigger..
But that was not the case.
Do i need some more thing to do?
Anything in the Thisworkbook Object
Or, Did i missed something.
Plz Help.
|