WD: Select Without End Select Error with Goto StatementLast reviewed: February 2, 1998Article ID: Q95421 |
The information in this article applies to:
SYMPTOMSWhen you use a Microsoft WordBasic Goto statement within a Case instruction, the following WordBasic error may result:
"SELECT without END SELECT"This error occurs if the Goto statement jumps out of the Case instruction before running an End Select statement.
WORKAROUNDTo work around this error, add an additional End Select statement below the Goto label or place the Goto statement outside of the Case instruction. NOTE: Jumping outside of a Select Case control structure with a Goto statement is not recommended. Each control structure should be self-contained.
STATUSMicrosoft has confirmed this to be a problem in the versions of Microsoft Word listed at the beginning of this article. This problem was corrected in Word 97 for Windows and Word 98 Macintosh Edition.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/supportnet/refguide/ ExampleThe following sample macro includes a Goto statement within the Case instructions and thus results in a "SELECT without END SELECT" error.
Sub MAIN n = 1 Select Case n Case 1 Goto Bye Case Else End Select Bye: End Sub Example WorkaroundsMove the Goto statement outside of the Case instructions, as in the following sample macros:
Sub MAIN n = 1 If n = 1 then Goto Bye Select Case n Case 2 Print "Case 2" Case Else End Select Bye: End Sub Sub MAIN n = 1 Select Case n Case 1 GotoLoc = 1 Case Else End Select If GotoLoc = 1 Then Goto Bye Bye: End SubAdd an additional End Select statement after the Goto label, as in the following macro sample:
Sub MAIN n = 1 Select Case n Case 1 Goto Bye Case Else End Select Bye: End Select End Sub REFERENCES"Using WordBasic" by WexTech Systems, Inc. and Microsoft Corporation, Microsoft Press, 1992, page 275.
|
Additional query words: error 130 winword2 8.0 8.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |