Results 1 to 9 of 9

Thread: Indents

  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Indents

    I posted a question earlier, and had to paste some VBA script into the post! I could not preserve the scripts indents, so it made it rather difficult to read. Could anyone tell me how to preserve indents on items pasted into a post.
    Regards,
    Rudi

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Indents

    You have to use the PRE tags in the 1-Click TagPanel
    Francois

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Indents

    Do i paste the entire script between the switches?

    Ah, tried it and it works....thanx
    Regards,
    Rudi

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Indents

    Yep.
    Bear in mind that using the <!t>[pre]<!/t> tag overides any word wrapping, and you may end up with a very wide post if you have long lines of code - this will require the use of the horizontal scroll bar to view.
    You will also get a warning in Preview that you are using the pre tag.

    Best thing is to mess about in the Test forum - try a post or two and see for yourself how it looks!

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Indents

    Just copy and past your code between the swithes.
    Something like this but without the spaces after the [
    <pre>[ pre]
    Function TableExist(TableName As String) As Boolean
    Dim db As DAO.Database
    Dim tdf As DAO.TableDef
    Set db = CurrentDb
    For Each tdf In db.TableDefs
    If tdf.Name = TableName Then
    TableExist = True
    GoTo TableExistExit
    End If
    Next tdf
    TableExist = False
    TableExistExit:
    Set tdf = Nothing
    Set db = Nothing
    End Function
    [ /pre]</pre>

    Francois

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Indents

    Thanx guys!
    Just something else on the subject. I read somewhere that when you copy code from a post and test it it say VBA, the tags affect the code. I've not come across it yet, but I recall HansV mentioning that you need to do something when copying code from a post. Could you refresh me on the procedure?
    Regards,
    Rudi

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Indents

    If you copy code within tags to the vba editor, you lose the carriage return at the end of each line.
    To avoid this, copy the code in a word document and re-copy it to the vba editor.
    Francois

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Indents

    If you copy code between <!t>[pre]<!/t> and <!t>[/pre]<!/t> tags and paste it directly into a Visual Basic Editor window, all line ends are lost, so you end up with all code on one line. The workaround is to paste the code into Word, immediately copy it again, then paste into the Visual Basic Editor.

    An alternative is to use <!t>[tab]<!/t> tags for indentation. See <post#=194019>post 194019</post#> by MarkD for a Word macro you can use to automate this. The rest of that thread is also informative.

  9. #9
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Made the note....Thanx guys!!!

    <P ID="nt"><font size=-1>(No Text)</font>
    Regards,
    Rudi

Posting Permissions

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