Reputation: 11520
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
Upvotes: 3
Views: 109
Reputation: 4256
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
Upvotes: 3