VB Syntax Error Appending : Lines to Sub or Function Statement

ID Number: Q74407

1.00

WINDOWS

buglist1.00

Summary:

A syntax error may occur when a Sub or Function statement is followed

by another statement on the same line, even when separated by a colon

(:).

Microsoft has confirmed this to be a problem in Microsoft Visual Basic

programming system version 1.0 for Windows. We are researching this

problem and will post new information here as it becomes available.

More Information:

To illustrate the problem, type the following code onto a single line

within a Code window:

Sub Foo() : Print "Hello, World" : End Sub

An "Invalid outside Sub or Function" error occurs when you move the

cursor from this line.

If the Sub procedure Foo() already exists,

Sub Foo()

End Sub

then you can add code after the procedure heading, Sub Foo(), if

separated by a colon, as follows:

Sub Foo() : Print "Hello World"

End Sub

Although it is possible to use more than one statement on the same

line with a procedure heading, Microsoft does not recommend this. A

procedure heading should always be on a line by itself.

Additional reference words: 1.00