Forum Discussion

Jeff43615's avatar
Jeff43615
Copper Contributor
Dec 06, 2022
Solved

Excel vba declared a variable using object

I stupidly decided to name a shape variable as so:

 

Dim shaPes as Shape

 

I have since removed the variable and all usage of it from the entire project. Even though I have, every time I want use "Sheet.Shapes" it changes automatically to "Sheet.shaPes". I wouldn't care but it causes the Shape object to fail of course.

 

Any help would be appreciated!

  • SnowMan55's avatar
    SnowMan55
    Bronze Contributor

    Jeff43615 Did this behavior still occur after you removed the variable, closed Excel, and reopened the workbook?  If so, my suggestion is to use the VBE Tools | References dialog to note the relative location of "Microsoft Excel nn Objects Library", then (temporarily) place that reference at the top in priority.  Save, close, reopen, and check again.

Resources