Consulting

Results 1 to 10 of 10

Thread: etting VBE Options Programatically

  1. #1

    etting VBE Options Programatically

    Is there a way to change the VBE options like color programatically?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I think not, I don't believe the properties are exposed.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    I was afraid you'd say that. I looked and looked but couldn't find anything. Oh, well ...
    Thanks for the reply, xld.

  4. #4
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    A couple of things I've found out about the VBE:

    Some of the VBE settings are held in the registry:
    HKEY_CURRENT_USER\Software\Microsoft\VBA

    If you set a reference to the file VBE6EXT.OLB in the object browser. You can
    view the objects and properties which you can change via VBA.

    Although this doesn't answer your question, I thought it might help in pointing you in the direction to what is possible to code via VBA in regards to programming the VBE.

    But I reckon you knew this anyway.

  5. #5
    Yes, that's interesting stuff. I'll follow up on it. Thanx, Marcster

  6. #6
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location
    Some of the VBE settings are held in the registry:
    HKEY_CURRENT_USER\Software\Microsoft\VBA

    If you set a reference to the file VBE6EXT.OLB in the object browser. You can
    view the objects and properties which you can change via VBA.
    Looks very interesting, does it put the objects into my object browser once i create a reference then and is there a way to just look at the objects from that location?

    Cancel that, clearly it does now i ve found my way around the object browser a bit better, very useful

    thanks

    Gibbo

  7. #7
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hi people ,

    I know this thread is closed but have been looking abit more into this (you need some knowledge of the Registry) and found:

    Using Excel 2000 the VBE editor colours seem to be held in the registry is this location:

    BE VERY CAREFUL WHEN BROWSING/CHANGING VALUES IN YOUR REGISTRY AS ONE FALSE MOVE CAN MAKE YOUR PC UN-BOOTABLE !!!

    HKCU\Software\Microsoft\VBA\6.0\Common\CodeForeColors

    If you don't find the registry key, go into the VBE options and change the Syntax Error Text in Code Colors on the Editor Format tab of the VBE options dialog.

    The registry location should display a row of numbers like "0 0 7 0 1 10 14 0 0 0 0 0 0 0 0 0 ", don't know what they mean but they change value when you change the colors in the Code Colors section in the Editor Format tab in the VBE options dialog.

    If you can work out what the numbers mean, then you could write a procedure using WScript.Shell. You need a reference to "Microsoft Scripting Runtime" though, file name: scrrun.dll

    But why would you want to be able to change the VBE colours via VBA?

    Marcster

  8. #8
    Yes, why would I want to do such a thing? Well, I recently sent a copy of a workbook to a gent who had difficulty reading the Excel sheet because he is color blind and he couldn't adjust to the colors I use for myself. I added a button to the sheet so that he or anyone else can quickly change the sheet colors to white background and black text. That helped him a lot. Then it occurred to me that I hadn't done anything to change the colors on the VBE. So I decided to look into it to see if I can change those color programatically. You never know how someone else will react to your own beautiful color scheme. They may very well be unable to read it!

  9. #9
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Well, yes, it is true that the VBE colours are held in the registry and you can change them that way, but

    The settings in the registry are loaded when VBA is initialised within an application and not released until the parent application is closed. When you make a change via the GUI, the VBE changes its settings and updates the registry. If all you do is change the registry, your change will not take effect until the next time the VBE is initialised.

    So if you've already been into the VBE (and found out the colors aren't what you want) and then you run code to change the registry setting, you will then have to quit the parent application and restart it for the change to take effect.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  10. #10
    Hmmm, that doesn't sound like a slick technique then.

Posting Permissions

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