Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to path to user's desktop


Is there a function that will return the User's Name or the path to
their desktop folder?


--
1scant
------------------------------------------------------------------------
1scant's Profile: http://www.excelforum.com/member.php...o&userid=31635
View this thread: http://www.excelforum.com/showthread...hreadid=552615

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to path to user's desktop

The desktop is one of the special folders:

http://support.microsoft.com/default...b;en-us;252652
HOWTO: Use the SHGetFolderPath Function from Visual Basic

http://msdn.microsoft.com/library/de...nums/csidl.asp

or you can use the windows scripting host:

Create a link to the Windows Scripting Host Runtime libary
C:\WINDOWS\SYSTEM\WSHOM.OCX


Name is: IWshRuntimeLibrary


In Tools=References in the VBE it will be listed as: Windows Scripting Host
Object Model or something similar.


You can use this to get your desktop location:


Sub Tester15()

Dim wsh As New IWshShell_Class
Dim DesktopPath As String
DesktopPath = wsh.SpecialFolders.Item("Desktop")
msgbox DeskTopPath
end Sub


or without setting the reference

Sub Tester16()
Dim wsh As Object
Dim DesktopPath As String
set wsh = CreateObject("wscript.shell")
DesktopPath = wsh.SpecialFolders.Item("Desktop")
msgbox DeskTopPath
end Sub

--
Regards,
Tom Ogilvy

"1scant" wrote:


Is there a function that will return the User's Name or the path to
their desktop folder?


--
1scant
------------------------------------------------------------------------
1scant's Profile: http://www.excelforum.com/member.php...o&userid=31635
View this thread: http://www.excelforum.com/showthread...hreadid=552615


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to path to user's desktop


:) Beautiful! And I got your reply just at the right time.


--
1scant
------------------------------------------------------------------------
1scant's Profile: http://www.excelforum.com/member.php...o&userid=31635
View this thread: http://www.excelforum.com/showthread...hreadid=552615

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel user's manual Doug Excel Discussion (Misc queries) 3 December 2nd 08 05:59 PM
EXCEL FILES SAVED TO DESKTOP WILL NOT OPEN FROM DESKTOP randy111 Excel Discussion (Misc queries) 3 January 13th 08 10:38 PM
hyperlink navigation path path wrong in Excel 2003 CE Admin Excel Discussion (Misc queries) 5 January 7th 06 07:47 PM
How can VBA retrieve user's IP Address [email protected] Excel Programming 1 August 15th 05 08:50 PM
insert a user's name/id benb Excel Discussion (Misc queries) 1 January 10th 05 08:05 PM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"