ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User function and Open Event (https://www.excelbanter.com/excel-programming/303416-user-function-open-event.html)

Yuriy

User function and Open Event
 
I have this code:

Private Sub Workbook_Open()
startmodel
End Sub

In Excel 97 this do not working! In 2003 this works perfect... After
debugging I find strange thing... Into workbook I use user function
for dividing...:

Function div0(a, b) As Double
Dim result As Double
If b = 0 Then
result = 0
Else
result = a / b
End If
div0 = result
End Function


If I set " Manual Calc" all is OK (after loading workbook "starmodel"
executes perfekt)?! But if calculating is automatic when book loads
"startmodel" not starting? How to resolve this problem into Excel97
without setting Manual Calculating?

TIA


Nigel

User function and Open Event
 
Are you saying that the open workbook event is not working or that your
function is not working?

What does your 'startmodel' procedure do, maybe this is where the problem
lies?

Cheers
Nigel

"Yuriy" wrote in message
...
I have this code:

Private Sub Workbook_Open()
startmodel
End Sub

In Excel 97 this do not working! In 2003 this works perfect... After
debugging I find strange thing... Into workbook I use user function
for dividing...:

Function div0(a, b) As Double
Dim result As Double
If b = 0 Then
result = 0
Else
result = a / b
End If
div0 = result
End Function


If I set " Manual Calc" all is OK (after loading workbook "starmodel"
executes perfekt)?! But if calculating is automatic when book loads
"startmodel" not starting? How to resolve this problem into Excel97
without setting Manual Calculating?

TIA




Yuriy

User function and Open Event
 
Worksheet_Open not working:(
Thos not working too (in Excel97!) Same result (no result)

Private Sub Workbook_Open()
Msgbox("blah")
End Sub

I make thos to work with this code, but I think that is stupid to make
such things:) Somebody have this strange problem?! Where is mistake
and how to find a problem... Strange that into Excel2003 allright,
into '97 no:)

This is workin code (looks strange for me):


Private Sub Workbook_Open()
startmodel
Application.Calculate
Application.Calculation = xlCalculationAutomatic
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
endmodel
Application.Calculation = xlCalculationManual
End Sub



TIA



On Wed, 7 Jul 2004 11:44:09 +0100, "Nigel"
wrote:

Are you saying that the open workbook event is not working or that your
function is not working?

What does your 'startmodel' procedure do, maybe this is where the problem
lies?

Cheers
Nigel

"Yuriy" wrote in message
.. .
I have this code:

Private Sub Workbook_Open()
startmodel
End Sub

In Excel 97 this do not working! In 2003 this works perfect... After
debugging I find strange thing... Into workbook I use user function
for dividing...:

Function div0(a, b) As Double
Dim result As Double
If b = 0 Then
result = 0
Else
result = a / b
End If
div0 = result
End Function


If I set " Manual Calc" all is OK (after loading workbook "starmodel"
executes perfekt)?! But if calculating is automatic when book loads
"startmodel" not starting? How to resolve this problem into Excel97
without setting Manual Calculating?

TIA





All times are GMT +1. The time now is 08:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com