Visual Basic - crear carpeta y accesos directos

Life is soft - evento anual de software empresarial
 
Vista:

crear carpeta y accesos directos

Publicado por mari (4 intervenciones) el 12/03/2006 20:26:08
Hola a todos

Tengo que crear con visual Basic una carpeta en el menú inicio y luego adentro de la carpeta crear accesos directos de archivos de Excel

MARI
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:crear carpeta y accesos directos

Publicado por Cecilia Colalongo (3116 intervenciones) el 13/03/2006 09:27:07
Fijate con esto:

Set loShell=CreateObject("wscript.Shell")
Set loShortcut=loShell.CreateShortcut(GetSpecialFolder(CSIDL_PROGRAMS)+"\MiAccesoDirecto.lnk")

With loShortcut
.TargetPath="MiAplicacion.htm"
.WorkingDirectory="DirectorioDeTrabajo"
.Save
End With

Para determinar la carpeta del escritorio o la de programas:

Const CSIDL_DESKTOP = &H0
Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_STARTMENU = &HB
Const CSIDL_COMMON_STARTMENU = &H16
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_COMMON_STARTUP = &H18
Const CSIDL_COMMON_FAVORITES = &H1F

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 ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
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 Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
Path$ = Space$(512)
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar