3

I have an own class (ClassFoo) with a simple property (pName), and I could not set it, because I always get error ...

Class Modules - ClassFoo
---
Public pName as String

Public Property Let Name(Value as String)
   pName = Value
End Property
----
Somewhere else in the ModuleX
...
Dim Foo as ClassFoo
Foo.Name = "foo" <- throws error 
Foo.pName = "foo" <- throws error 

or

With Foo
.pName = "foo" <- throws error 
End With 

I changed the class 'Instancing' from 'Private' to 'PublicNotCreatable' (back and forth) But I still have the same error ...

Thanks for the replies in advance.

Cs

2 Answers 2

7

You need to create an instance & assign it to Foo so;

Dim Foo as ClassFoo
Set Foo = new ClassFoo
Sign up to request clarification or add additional context in comments.

Comments

2

You need to instantiate it I believe try

 Dim foo as new ClassFoo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.