Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default error traping

Sub WView(ViewNb)
Application.EnableEvents = False
On Error GoTo Gone
Select Case ViewNb
Case 1
With Application
'.WindowState = xlNormal
.Width = 680
.Height = 573
End With
Case 2
With Application
'.WindowState = xlNormal
.Width = 763
.Height = 573
End With
End Select
Gone:
Application.EnableEvents = True
End Sub
This wont work. The error message is displayed and error halts operation.
Looked everywhere and experimented with a lot of variations.
Thanks for your help.

--
Jim at Eagle
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default error traping

works fine. I used

Option Explicit
Sub tester()
WView 2
End Sub
Sub WView(ViewNb)

With Application
Select Case ViewNb
Case 1
.Width = 300
.Height = 573
Case 2
.Width = 900
.Height = 573
End Select
End With

End Sub


Have you got workbook protection set?


"Jim at Eagle" wrote:

Sub WView(ViewNb)
Application.EnableEvents = False
On Error GoTo Gone
Select Case ViewNb
Case 1
With Application
'.WindowState = xlNormal
.Width = 680
.Height = 573
End With
Case 2
With Application
'.WindowState = xlNormal
.Width = 763
.Height = 573
End With
End Select
Gone:
Application.EnableEvents = True
End Sub
This wont work. The error message is displayed and error halts operation.
Looked everywhere and experimented with a lot of variations.
Thanks for your help.

--
Jim at Eagle

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default error traping

The problem is the error trap. If the workbook is started in xlMaximized then
a error occurs. I added WindowState = xlNormal to solve this problem (it's
commented out here just to crash the code on my machine for testing purpose).
However the code still fails on some computers. So I want to eliminate all
window size resize functionality from the procedures. I thought an error
operation would do this, but it doesnt work. My computer handles quite
nicely but Franks dont. I dont want to remove my uncle from my universe.

--
Jim at Eagle


"Patrick Molloy" wrote:

works fine. I used

Option Explicit
Sub tester()
WView 2
End Sub
Sub WView(ViewNb)

With Application
Select Case ViewNb
Case 1
.Width = 300
.Height = 573
Case 2
.Width = 900
.Height = 573
End Select
End With

End Sub


Have you got workbook protection set?


"Jim at Eagle" wrote:

Sub WView(ViewNb)
Application.EnableEvents = False
On Error GoTo Gone
Select Case ViewNb
Case 1
With Application
'.WindowState = xlNormal
.Width = 680
.Height = 573
End With
Case 2
With Application
'.WindowState = xlNormal
.Width = 763
.Height = 573
End With
End Select
Gone:
Application.EnableEvents = True
End Sub
This wont work. The error message is displayed and error halts operation.
Looked everywhere and experimented with a lot of variations.
Thanks for your help.

--
Jim at Eagle

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default error traping

Jim at Eagle wrote:
The problem is the error trap. If the workbook is started in
xlMaximized then a error occurs. I added WindowState = xlNormal to
solve this problem (it's commented out here just to crash the code on
my machine for testing purpose). However the code still fails on some
computers. So I want to eliminate all window size resize
functionality from the procedures. I thought an error operation would
do this, but it doesn't work. My computer handles quite nicely but
Franks don't. I don't want to remove my uncle from my universe.


In the VBE go to Tools | Options and on the General tab, ensure that Error
Trapping is set to Break on Unhandled Errors.

Rob


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default error traping

Rob is there a way to program in that setting so that strange computers use
spreadsheet?
--
Jim at Eagle


"Robert Bruce" wrote:

Jim at Eagle wrote:
The problem is the error trap. If the workbook is started in
xlMaximized then a error occurs. I added WindowState = xlNormal to
solve this problem (it's commented out here just to crash the code on
my machine for testing purpose). However the code still fails on some
computers. So I want to eliminate all window size resize
functionality from the procedures. I thought an error operation would
do this, but it doesn't work. My computer handles quite nicely but
Franks don't. I don't want to remove my uncle from my universe.


In the VBE go to Tools | Options and on the General tab, ensure that Error
Trapping is set to Break on Unhandled Errors.

Rob





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default error traping

Jim at Eagle wrote:
Rob is there a way to program in that setting so that strange
computers use spreadsheet?

Jim at Eagle wrote:
<....

In the VBE go to Tools | Options and on the General tab, ensure that
Error Trapping is set to Break on Unhandled Errors.

Rob


No. There may be hacks using sendkeys and/or possibly setting a registry
value, but there is no direct way of doing this using either the Excel or
VBE object models. The good news is that once the setting is done it will
persist across subsequent Excel sessions (unless/until the user resets it,
of course). However, if the user is stuck with Excel 97, the setting does
*not* persist and defaults to Break in Class Module every time Excel starts.
This is the main reason I have never used class modules in Excel, but have
always built all of my business logic into VB6 dlls.

Rob


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error traping

However, if the user is stuck with Excel 97, the setting does
*not* persist and defaults to Break in Class Module every time Excel

starts.


Must be the UK version. I have never noted this in Excel 97 (US)

Does it happen always, or only when the project contains a class module?

--
Regards,
Tom Ogilvy

"Robert Bruce" <rob@analytical-dynamicsdotcodotukay wrote in message
...
Jim at Eagle wrote:
Rob is there a way to program in that setting so that strange
computers use spreadsheet?

Jim at Eagle wrote:
<....
In the VBE go to Tools | Options and on the General tab, ensure that
Error Trapping is set to Break on Unhandled Errors.

Rob


No. There may be hacks using sendkeys and/or possibly setting a registry
value, but there is no direct way of doing this using either the Excel or
VBE object models. The good news is that once the setting is done it will
persist across subsequent Excel sessions (unless/until the user resets it,
of course). However, if the user is stuck with Excel 97, the setting does
*not* persist and defaults to Break in Class Module every time Excel

starts.
This is the main reason I have never used class modules in Excel, but have
always built all of my business logic into VB6 dlls.

Rob




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default error traping

Roedd <<Tom Ogilvy wedi ysgrifennu:

However, if the user is stuck with Excel 97, the setting does
*not* persist and defaults to Break in Class Module every time Excel
starts.



Must be the UK version. I have never noted this in Excel 97 (US)

Does it happen always, or only when the project contains a class
module?


I thought this was well documented. A quick google-groups gives me:

http://tinyurl.com/abtty
http://tinyurl.com/cuolp
http://tinyurl.com/9v8vy
http://tinyurl.com/at7jf
http://tinyurl.com/ccgsc

etc...

--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error traping

It appears it only happens when the project contains a class - which is what
I asked.

Thanks.

--
Regards,
Tom Ogilvy

"Robert Bruce" <rob@analytical-dynamicsdotcodotukay wrote in message
...
Roedd <<Tom Ogilvy wedi ysgrifennu:

However, if the user is stuck with Excel 97, the setting does
*not* persist and defaults to Break in Class Module every time Excel
starts.



Must be the UK version. I have never noted this in Excel 97 (US)

Does it happen always, or only when the project contains a class
module?


I thought this was well documented. A quick google-groups gives me:

http://tinyurl.com/abtty
http://tinyurl.com/cuolp
http://tinyurl.com/9v8vy
http://tinyurl.com/at7jf
http://tinyurl.com/ccgsc

etc...

--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default error traping

Roedd <<Tom Ogilvy wedi ysgrifennu:

It appears it only happens when the project contains a class - which
is what I asked.



Actually Tom, the setting is application-wide and really doesn't concern
itself with the current (or indeed any other) project.

In any case, don't all projects contain at least one class module
(ThisWorkbook)? ;-)

--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.


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
Error of slope taking into account error of the data points cer144 Excel Worksheet Functions 5 July 7th 08 07:26 PM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 03:44 AM.

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"