Initdir to Desktop

ahelgeson used Ask the Experts™
OK, so to get to the
Application Path, you would put:
CommonDialog1.Initdir = App.Path

To get to the Windows Directory, you would put:
CommonDialog1.Initdir = Environ("WinDir")

How do I set the open dialog to open to the desktop?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


I just figured it out:

CommonDialog.InitDir = Environ("USERPROFILE") & "\Desktop"
That's correct if the user keeps the default name for the Desktop.  If not, you'll have to get it from the registry.  This has been documented elsewhere in EE, so a search should reveal the code to do this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial