Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error of slope taking into account error of the data points | Excel Worksheet Functions | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming |