Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Udo Udo is offline
external usenet poster
 
Posts: 48
Default Error 1004 occurs only in specific cases

Hi experts,

a simple macro that is executed on the start of Excel generates an - at
least for me - puzzling effect. The macro is part of a workbook which
is in the folder XLStart, so it will be opened every time Excel is
started. When I start Excel directly it works perfectly well without
any problem. Whenever I start Excel indirectly by opening any other
workbook, then I get the error 1004, specifying that Excel can't
execute the first line of the macro ("Method 'Calculation' of the
object 'Application' does not work").
These are the first lines of the macro:

With Application
.Calculation = xlCalculationManual
.MaxChange = 0.001
End With
Call CreateMenu
Windows("Personl.xls").Visible = False
ThisWorkbook.Sheets("Menu_Blatt").Visible =
xlVeryHidden

Do you have any hints how to prevent this effect (except never starting
Excel indirectly... ;-) )?
Thanks in advance
Udo

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Error 1004 occurs only in specific cases

There are some settings that need to have an activeworkbook to change.

If you close all the workbooks with visible windows and try to do it manually,
then you'll see the same problem.

dim tempwkbk as workbook
set tempwkbk = nothing
if activeworkbook is nothing then
set tempwkbk = workbooks.add
end if
'change the setting

if tempwkbk is nothing then
'do nothing
else
tempwkbk.close savechanges:=false
end if

ps.

Did you spell personal.xls correctly?

Udo wrote:

Hi experts,

a simple macro that is executed on the start of Excel generates an - at
least for me - puzzling effect. The macro is part of a workbook which
is in the folder XLStart, so it will be opened every time Excel is
started. When I start Excel directly it works perfectly well without
any problem. Whenever I start Excel indirectly by opening any other
workbook, then I get the error 1004, specifying that Excel can't
execute the first line of the macro ("Method 'Calculation' of the
object 'Application' does not work").
These are the first lines of the macro:

With Application
.Calculation = xlCalculationManual
.MaxChange = 0.001
End With
Call CreateMenu
Windows("Personl.xls").Visible = False
ThisWorkbook.Sheets("Menu_Blatt").Visible =
xlVeryHidden

Do you have any hints how to prevent this effect (except never starting
Excel indirectly... ;-) )?
Thanks in advance
Udo


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
Udo Udo is offline
external usenet poster
 
Posts: 48
Default Error 1004 occurs only in specific cases

Hi Dave,

thanks for the response.
I entered your suggested code before the existing part. The error
message is still exactly the same. Or did I get you wrong? Can you give
more details?

Thank you in advance
Udo

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Error 1004 occurs only in specific cases

I think you'll have to share what you did.

Udo wrote:

Hi Dave,

thanks for the response.
I entered your suggested code before the existing part. The error
message is still exactly the same. Or did I get you wrong? Can you give
more details?

Thank you in advance
Udo


--

Dave Peterson
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
Formula for Cases=144 * # of Cases + Pieces Inventory Formula Excel Discussion (Misc queries) 2 December 29th 09 09:09 PM
count specific text that occurs in a range of cells Tim Excel Discussion (Misc queries) 16 October 10th 06 01:41 AM
MsgBox when an Error occurs Vick Excel Discussion (Misc queries) 1 December 21st 05 08:48 PM
formula to extract specific data if match occurs jerry Excel Worksheet Functions 2 February 24th 05 11:06 AM
Auto_add not called, but not found error occurs Robin Hammond Excel Programming 0 October 3rd 03 02:09 AM


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