View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary W. Misner Gary W. Misner is offline
external usenet poster
 
Posts: 4
Default Using default file locations in VBA programming

Brian

You got me started down the right path.

This is what wound up using.

Sub Desktop_Path()
Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")
Dim DesktopPath As String

' Read desktop path using WshSpecialFolders object
DesktopPath = WSHShell.SpecialFolders("Desktop")
Debug.Print DesktopPath

DesktopPath = WSHShell.SpecialFolders("Mydocuments")
Debug.Print DesktopPath

Set WSHShell = Nothing

End Sub

hope you might find it usefull.

Thanks,
Gary m.



"BrianB" wrote in message
...

This may help you towards your goal :-
'-------------------------------------
Sub RetrieveLogonName()
Dim wshNetwork As Object
Dim LogonName As Variant
Set wshNetwork = CreateObject("WScript.Network")
LogonName = wshNetwork.UserName
MsgBox LogonName
End Sub
'--------------------------------------


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements