+ Reply to Thread
Results 1 to 7 of 7

Strange behaviours while typing code in VBA editor

  1. #1
    Registered User
    Join Date
    01-18-2010
    Location
    Nova Scotia, Canada
    MS-Off Ver
    Excel 2003
    Posts
    68

    Strange behaviours while typing code in VBA editor

    Hi all... this is probably gonna sound really stupid, but how come when I try to type in some code in the VBA Editor, things act all weird:

    - the text I'm typing sometimes gets all "rearranged" automatically (ie. first letter I type will be at the end all of a sudden)
    - the text of the current line I'm on turns all red
    - In the middle of typing something, a window will pop up "Syntax Error" even before I'm done typing.

    ... it's really frustrating. As you can gather, I'm a VBA newbie..

    Thanks!
    Shawn

  2. #2
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Strange behaviours while typing code in VBA editor

    Shawn - it almost sounds like something else is running in the background... another macro from another book, perhaps?

  3. #3
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Smile Re: Strange behaviours while typing code in VBA editor

    Hello,
    * The 1st issue is kinda wierd, but the other two sound like normaI design errors.
    * I am a newbie to Excel VBA also. After struggling with it for months (getting tips & help over the internet), I finally went and bought a book for $25 at the local B&N. Probably shouldn't endorse book on forum (not sure if that is proper or not). Point Here: It was the best thing I've done to help me get a better handle on VB; I should have done it months ago.
    * This book defines 4 levels of errors: 1) Design errors, 2) Compile errors, 3) Runtime errors, 4) Logicial Errors. The latter two issues, sound like Design errors. They happen to all of us. If you don't type something right (like an If Then statement), or put an '=' in without filling the right side and move off the line, then you get this error. You just have to OK the alarm, and move on.
    * Not sure what might be causing the 1st issue. ... Regards, sauerj

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Strange behaviours while typing code in VBA editor

    Probably shouldn't endorse book on forum (not sure if that is proper or not).
    Totally proper, endorse away if you liked it.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    01-18-2010
    Location
    Nova Scotia, Canada
    MS-Off Ver
    Excel 2003
    Posts
    68

    Re: Strange behaviours while typing code in VBA editor

    Thanks all... nope, there's no other workbook running in the background. Just my one main workbook that has several sheets and live DDE data coming into it - maybe that has something to do with it?

    Regarding my VBA editing problems, I see a "Reset" and a "Break" button in the toolbar at top. Should they be set in any particular way when I'm trying to type?

  6. #6
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Talking Re: Strange behaviours while typing code in VBA editor

    Thanks "shg"! ... Thanks a lot for your past help to me!
    1) The book is "Excel Programming, Your visual blueprint for creating interative spreadsheets", 2nd Ed., by Jinjer Simon, Wiley Publishing, Inc, 2005.
    2) It is 300 pages, comes with a disc containing electronic version of book and example macros. I'm about 50% thru it. I've found a few typos and maybe 1-2 errors, but it is SO easy to read and understand.
    3) What really HELPED me a lot was explaining 1) what Excel means by Objects, and 2) Introducing me to the Object Browser, what it is, how to use, etc. WOW! finally things started to make some sense; and what a powerful tool this Obj-Browser offers. ... A book may not be for everyone (takes time to read), but sure worked for me.
    4) Of course, the internet is very helpful too. And, when I'm really stomped, this forum is TOP-NOTCH!

  7. #7
    Registered User
    Join Date
    10-06-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Strange behaviours while typing code in VBA editor

    I found this thread while searching for an explanation for the same problem. For me it goes away if I reboot my computer. Same code, same everything. When it occurs, i can type a letter/word and press space and it seems that for everytime i hit the space bar, the editor enters a backspace. To continue coding, I can finish the line and go back to put spaces in. Then it will take the spaces and the letters will turn blue, green or black as necesary. Sometimes, while typing it will place my cursor somewhere back in the text and then its frustrating.......
    I will say, that it seems to occur when im using the following classes: SHDocVw & MSHTML.
    Im not sure if an object class should be causing these kind of issues, and like i said, the problem goes away if I reboot.

    Thanks,
    Wayne Hilburn

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1