como guardo en el escritorio????
tengo un programa hecho en visual que genera un archivo excel, quiero que ese archivo al generarse se guarde en el escritorio, como puedo hacer???? tengo windows 2000
Option Explicit
Const CSIDL_DESKTOP = &H0
Const MAX_PATH = 260
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Sub Form_Load()
MsgBox "Ruta del escritorio: " & Escritorio(CSIDL_DESKTOP)
End Sub
Private Function Escritorio(CSIDL As Long) As String
Dim IDL As ITEMIDLIST, NOERROR
Dim Resultado As Long, Ruta As String
Resultado = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If Resultado = NOERROR Then
Ruta = Space$(512)
Resultado = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Ruta)
Escritorio = Left(Ruta, InStr(Ruta, Chr(0)) - 1)
End If
End Function
Const CSIDL_DESKTOP = &H0
Const MAX_PATH = 260
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Sub Form_Load()
MsgBox "Ruta del escritorio: " & Escritorio(CSIDL_DESKTOP)
End Sub
Private Function Escritorio(CSIDL As Long) As String
Dim IDL As ITEMIDLIST, NOERROR
Dim Resultado As Long, Ruta As String
Resultado = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If Resultado = NOERROR Then
Ruta = Space$(512)
Resultado = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Ruta)
Escritorio = Left(Ruta, InStr(Ruta, Chr(0)) - 1)
End If
End Function