Consulting

Results 1 to 7 of 7

Thread: VBA Coding window highlights text red and then deletes

  1. #1

    VBA Coding window highlights text red and then deletes

    I am having a strange problem that I have never had before with VBA.

    Whenever I try to type something in the main code window for anything (a Worksheet/Userform/Modules), as I type VBA keeps highlighting my code in red and if I stop typing VBA begins to delete what I just typed (usually one or two characters).

    This is only happening for the workbook that I am currently working on, all the other ones are fine.

    I just wanted to know if there was some setting that I accidentally hit that is causing VBA to do this.

    I am using a lot of ActiveX controls which may be the issue.

    Edit: I tried deleting everything of of my first worksheet code window and typed in a random three letters and hit space. It keeps popping up a window that says "invalid outside procedure." Windows keep popping up and I eventually just have to force quite (after 15-30 are on the screen and more are coming).

    I also tried on another laptop and the same thing happened (with this workbook).

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Welcome to the forum!

    Check in VBE: Tools > Options > Auto Syntax Check

    I set all of those options. I don't see how it would delete characters.

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi, welcome to the board!

    The deleting of characters issue, I wonder if you have a sticky keyboard perhaps?

    The "invalid outside procedure" is generally when you have code outside of a standard sub routine. Check them and make sure this isn't happening. Can you post your code here?

  4. #4

    Here's the code

    This is the workbook containing the code that is messing up VBA.

    I know the code is extremely messy (I'm just beginning VBA, this is just a project for class). I also couldn't comment on the code since VBA liked to delete it.

    At least this will let you see what I am talking about.
    Attached Files Attached Files

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    What is the offending code? It runs fine for me.

  6. #6

    Fixed

    Turns out that the error happened when I had some items run when VBA started. I deleted them when I uploaded the file so nobody would have to deal with them to get to the code, that's why nobody saw the problems. I stopped the processes that ran in the beginning and now everything runs perfectly.

    Thank You

  7. #7
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Usually when such problems occur, you can simply press the Design Mode button to be able to work normally in the VB Editor.
    Be as you wish to seem

Posting Permissions

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