Search code examples
excelvbaoffice365code-formattingmacos-monterey

certain VBA keywords (Add, Format) can't capitalize properly in VBE (As if I declared it as variable)


I was writing my code as usual, until suddenly I realized that certain keywords (so far, it is add and format) that won't capitalize properly after entering the line, as if it was set as variable name, (which I didn't.)

Selecting the keyword to find the definition also would not lead to any variable, just the Object Browser.

SHEET1.LISTOBJECTS(1).LISTROWS.ADD 'before going to next line [Enter] 
Sheet1.ListObjects(1).ListRows.Add 'The expected case change (like `Proper` function)
Sheet1.ListObjects(1).ListRows.add 'The `add` keyword won't budge for me
DEBUG.? FORMAT(NOW,"YYYY") 'before going to next line [Enter] 
Debug.Print Format(Now,"YYYY") 'The expected case change and auto-complete of default value
Debug.Print format(Now,"YYYY") 'The `format` keyword won't budge for me. 

I checked all the subroutines, in ThisWorkbook, each WorkSheet, each Module including those in Personal.xlsb, There was nothing that resembles add and format wording in the Names Manager or lambda/let function too. Neither was Automator/Shortcuts/Script Editors.

Even after moving out the codes (cutting all codes on a text file), the same still happens, which is impossible. ChatGPT recommended deleting VBE6.DAT file. But I am really curious about what else could have caused it? Or is it just another known bug for running Excel 365 on a Mac?

Please help to suggest a more suitable title if you think it is inappropriate enough, I couldn't think of one (Google certainly cant interpret the way I described it, to the extent that I need to start a post here)


Solution

  • You may have declared them without capitals elsewhere. You can do this by declaring a variable or method (function, sub, property).

    If you can't find "add" declared anywhere in your project, try adding a temporary declaration such as Dim Add and then removing it. You should see all your other Add methods capitalise.