NewAutoUser
NewAutoUser

Reputation: 573

Is VBA name property is case sensitive

I have observed that below line of code works on one machine but not on other even though both machines have same office 2007 versions.

strName = folderObj.Name

But when I convert property from '.Name' to '.name' then it is observed to be working on machine on which it was not working earlier. Below are some of sample code lines for which I am encountering issues. Per my observation where ever earlier I mentioned .Name is failing on another machine:

strName = folderObj.Name
Application.ActiveWorkbook.Name

Is there any setting which we may need to perform to ignore case for .name.

Upvotes: 0

Views: 1411

Answers (1)

Nick Spreitzer
Nick Spreitzer

Reputation: 10598

I remember dealing with a very similar issue a while back, but can't remember the specifics. I want say look for any references in your code to variables, properties, etc that are named 'name' (lower case) and change them to 'Name' (pascal case). I have a vague memory of VBA getting confused when you use different casing for items of the same name. (For the lack of a more technical explanation.) I know this doesn't really address the fact that it runs on one computer but not another, but it's worth a look.

Btw, when you say "it's not working" what error are you getting?

Upvotes: 1

Related Questions