Results 1 to 5 of 5

Thread: Coloring / highlighting code

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    223

    Coloring / highlighting code

    Is there some way I can color certain parts of VBA code?

    I'm supposed to fold two sets of code changes into one unified code base. While I'm doing this (and the inevitable debugging afterwards), I'd like to identify which prototype a particular piece of code came from.

    I could use comments, e.g.

    ' This came from prototype 1
    blah blah blah
    blah blah blah
    blah blah blah


    ' This came from prototype 2
    blah blah blah
    blah blah blah

    ' This came from prototype 1
    blah blah blah

    But it would be nicer if I could change the code color, say, green for prototype 1 and blue for prototype 2.

    Is this sort of thing possible with VBA?

    Thanks!

  2. #2
    New Member
    Join Date
    Feb 2008
    Posts
    3

    Re: Coloring / highlighting code

    Select the text you want to color.
    In the editor, you can go to Tool > Options > Editor Format (TAB).
    Then click 'Selection' from the left list box, then choose the foreground color you want the text to be.

    Should be what you need.
    Hope this helps.

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Coloring / highlighting code

    Quote Originally Posted by dbrother
    Select the text you want to color.
    In the editor, you can go to Tool > Options > Editor Format (TAB).
    Then click 'Selection' from the left list box, then choose the foreground color you want the text to be.

    Should be what you need.
    Hope this helps.
    The only hitch is that the moment you "comment" the colored piece of code, it will change back to green...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4
    New Member
    Join Date
    Feb 2008
    Posts
    3

    Re: Coloring / highlighting code

    Hmm.. seems like you're correct. I wouldn't advise any custom 'color-coding' of you own in case someone in the furture needs to support your application.

    The color-coding may make sense to you, but might throw a newbie or other off becuase of the different format.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    223

    Re: Coloring / highlighting code

    It's my own code. Nobody will be supporting if they are not me. I think I can handle it. ;-)

    That's too bad. It's a powerful IDE that I've grown to love, but there are certain things I really would like to tweak. I'd kill to have vim style keybindings or a more powerful/more convenient bookmarking system.

Posting Permissions

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



Click Here to Expand Forum to Full Width