Event to call before a opened workbook is recalculated

T

Torben Laursen

Hi

I have a add-in that defines a number of functions. When a user uses them
and saves a workbook When the user loads the workbook again I need to be
able to write some information to a dll before Excel recalculate the sheet.
At the moment the code is in the event WorkbookOpen but that is to late.

Can anyone tell me if there is a event that I can call before any
calculations are done?

Thanks Torben Laursen
 
T

Torben Laursen

Hi Frank

Thanks
But my userdefined functions are called before the workbookopen event.
Is there a way so I can execute some code before they are called?

Thanks Torben Laursen
 
G

Guest

You can try this. It is a excel file that opens another excel file in a
seperate instance of Excel. You can fire whatever you want from here before
the workbok ever opens...

Option Explicit
Private Const m_strPath As String = "C:\Documents and
Settings\jamest\Desktop\Budget 2004\"
Private Const m_strFileName As String = "TestTemplate.xls"


Sub Auto_Open()
Dim appXL As Excel.Application
Dim wbk As Workbook

Set appXL = CreateObject("Excel.Application.9")
appXL.Visible = True
Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName)
wbk.RunAutoMacros xlAutoOpen
ThisWorkbook.Close SaveChanges:=False
End Sub
 
C

Charles Williams

You could either switch to manual before the workbook is opened, or
(probably safer) have a global switch which causes your UDFs to do nothing
unless the information has been written to the dll and then recalculate once
you have written the information to the dll.

Charles
______________________
Decision Models
FastExcel 2.1 now available
www.DecisionModels.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top