Guraknugen

New Member
Joined
Mar 15, 2017
Messages
35
Hi!

I have a simple function for returning the desktop path, and it has worked fine until now:
Code:
Public Function GetDesktopPathName() As String
    Dim oWSHShell As Object

    Set oWSHShell = CreateObject("WScript.Shell")
    GetDesktopPathName = oWSHShell.SpecialDirs("Desktop")
    Set oWSHShell = Nothing
End Function

From one day to another, running it suddenly throws this error message (translated from Swedish):
Runtime error 438
Object doesn't support the method or property.

The line causing this seems to be "GetDesktopPathName = oWSHShell.SpecialDirs("Desktop")"

What might cause this?
Is there a setting I need to do somewhere?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Ooops... I'm an idiot...! :(

Sorry for bothering you with this crap!

I changed the name of some variables recently, doing a search and replace from "Folder" to "Dir". Obviously I accidentally changed the name of "oWSHShell.SpecialFolders" to "oWSHShell.SpecialDirs". I feel really, really stupid now! :eek:

Anyone authorized, feel free to remove this thread or at least mark it "solved" or similar.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,670
Members
449,115
Latest member
punka6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top