Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    When I use Swish Max2 I can write more than one clause of code on a line by simply using a semicolon. When I try to do this with vba I get an error. Is it necessary to start each clause on a separate line or is there a way to save space and have multiple clauses per line? IE how to get:

    Code:
    let1.Visible = False
    let2.Visible = False
    let3.Visible = False
    let4.Visible = False
    onto a single line:

    Code:
    let1.Visible = False; let2.Visible = False; let3.Visible = False; let4.Visible = False
    Thanks,

    Chris (Hunt)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can separate instructions with a colon:

    let1.Visible = False: let2.Visible = False: let3.Visible = False: let4.Visible = False

    but I'd use it sparingly. In the early days of BASIC (the 1980s), combining instructions on a single line saved space (when each byte counted) and increased execution speed, but nowadays there's no advantage in doing so.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='768442' date='31-Mar-2009 14:16']You can separate instructions with a colon:

    let1.Visible = False: let2.Visible = False: let3.Visible = False: let4.Visible = False

    but I'd use it sparingly. In the early days of BASIC (the 1980s), combining instructions on a single line saved space (when each byte counted) and increased execution speed, but nowadays there's no advantage in doing so.[/quote]

    Thanks Hans, having some things together on the same line makes the code easier to follow and edit for me.

    Best wishes,

    Chris

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='Cah' post='768539' date='01-Apr-2009 09:30']Thanks Hans, having some things together on the same line makes the code easier to follow and edit for me.

    Best wishes,

    Chris[/quote]
    Hi Chris,

    When dimensioning variables, you can use a comma. Instead of:
    Dim str1 As String
    Dim str2 As String
    Dim str3 As String
    Dim Status As Boolean
    Dim MyData As DataObject
    Dim i As Integer

    you could eliminate all except the first 'Dim' with:
    Dim str1 As String, str2 As String, str3 As String, Status As Boolean, MyData As DataObject, i As Integer
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •