Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2003 VBA - setting "iteration" upon loading

Hi!

I have a problem regarding an add-in:

I'm trying to set "iteration" in a workbook_open event with the code:

Private Sub Workbook_Open()

With Application
.Iteration = True
.MaxIterations = 500
.MaxChange = 0.001
End With

But I get the error message

"Error 1014, Method 'iteration'of object application failed' when
Excel is started and loads the add-in

My Excel does not have iteration ticked off as default in the
tools/options/calculation. But why can not this be done with VB upon
start of Excel ?

If the add-in is loaded after Excel have been started, the
workbook_open event works ok, and the iteration is set.

Any suggestions ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2003 VBA - setting "iteration" upon loading

Close all visible workbooks.

Now go to Tools=Options

note that Options is grayed out. So if you don't have a visible workbook
open in Excel, I suspect you will not be able to change these parameters
(until you do have a visible workbook open).

Perhaps you need to instantiate Application Level events in your addin and
do the setting in the application level workbook_open event.

--
Regards,
Tom Ogilvy

"O_lanke" wrote in message
om...
Hi!

I have a problem regarding an add-in:

I'm trying to set "iteration" in a workbook_open event with the code:

Private Sub Workbook_Open()

With Application
.Iteration = True
.MaxIterations = 500
.MaxChange = 0.001
End With

But I get the error message

"Error 1014, Method 'iteration'of object application failed' when
Excel is started and loads the add-in

My Excel does not have iteration ticked off as default in the
tools/options/calculation. But why can not this be done with VB upon
start of Excel ?

If the add-in is loaded after Excel have been started, the
workbook_open event works ok, and the iteration is set.

Any suggestions ?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Excel 2003 VBA - setting "iteration" upon loading

Hi O_lanke,

My Excel does not have iteration ticked off as default in the
tools/options/calculation. But why can not this be done with VB upon
start of Excel ?


As Tom suggested, for some reason, that property can only be set when
there is a workbook active. You could, therefore, use:

Dim wkbTemp As Workbook

Set wkbTemp = Workbooks.Add
Application.Iteration = True
wkbTemp.Close False

with Application.ScreenUpdating switched off to avoid the flickering.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk


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
"Document not saved" "error in loading DLL" Tracey L Excel Discussion (Misc queries) 0 December 1st 08 12:57 PM
Excel 2003: Conditional Formatting using "MIN" & "MAX" function MMangen Excel Discussion (Misc queries) 2 September 16th 08 07:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
In Excel 2003 is there a way to prevent "Save As" and "Print"? lucky2000 Excel Discussion (Misc queries) 3 April 26th 07 02:49 PM
"Loading..." Splash Screen in Excel Bob Phillips[_6_] Excel Programming 0 July 20th 04 05:55 PM


All times are GMT +1. The time now is 08: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"