3

Why this fails?

set fldr = CreateObject("shell.application").BrowseForFolder(0, "Example", 0, 0).Self.Path

but this works:

fldr = CreateObject("shell.application").BrowseForFolder(0, "Example", 0, 0).Self.Path

1 Answer 1

3

Because the Set Statement is not for assigning string variables:

To be valid, objectvar must be an object type consistent with the object being assigned to it.

This, for example, would work:

Set objFldr = CreateObject("shell.application").BrowseForFolder(0, "Example", 0, 0)
strFldrPath = objFldr.Self.Path
Sign up to request clarification or add additional context in comments.

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.