Visual Basic - abrir carpeta

Life is soft - evento anual de software empresarial
 
Vista:

abrir carpeta

Publicado por Eduardo (67 intervenciones) el 07/07/2005 23:30:15
como puedo hacer para abrir carpetas del explorador por VB, o exactamente abrir el mi PC gracias
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:abrir carpeta

Publicado por ALEXIS (49 intervenciones) el 07/07/2005 23:47:23
Dir("ruta\*.*")

eso y listoco
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

RE:abrir carpeta

Publicado por Eduardo (67 intervenciones) el 08/07/2005 00:02:29
No pasa bada con ese codigo como puedo hacer???
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

Objetos Dirlist-Drivelist-Filelist

Publicado por Loud_in (110 intervenciones) el 08/07/2005 00:38:53
Es muy ambiagua tu duda debido ha que hay muchas formas de trabajar con datos del Disco duro.

Por ejemplo:
Puedes crear un cuadro de dialogo tu mismo utilizando los objetos Dirlist, drivelist y filelist. estos objetos pertencen al basico de Vb. para programarlos, te aconsejo que cojas el ejemplo de la ayudas de Vb y listo. Nota(Es muy arcaico tipo win95)
Sin embargo, para abrir archivos, guardar, etc. puedes utilizar el objeto CommonDialog este muestra un cuadro de dialogo segun el sistema operativo, y es facil de programar, en las ayudas, tambien te dice.

tambien, hay funciones y metodos para trabajar archivos, pero, por eso digo que tu duda es ambigua.
Dir - verifica un directorio o file
tambien esta los objetos logicos del scripting.systemFile o algo asi.

me cuentas.

Andres-Loud_in
Medellin-Colombia
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

RE:Objetos Dirlist-Drivelist-Filelist

Publicado por angel (1 intervención) el 12/04/2006 01:11:11
bueno quiero un programa ,donde se huse el dirlist ,drivelist,filelist
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

RE:Objetos Dirlist-Drivelist-Filelist

Publicado por cristina (1 intervención) el 07/01/2008 23:17:13
necesito la informacion porfavor ayudeme
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

Objetos Filelist-and-SubFolder List

Publicado por Tinno (2 intervenciones) el 14/09/2010 23:21:28
Option Explicit

Sub NEWOFNEW()
Rem create today 14/09/2010 for Tinno
Rem in Excel of course
Dim FSO As New FileSystemObject
Dim T As Object, ShApp As Object
Dim Dto As String
Dim f, A
Dim i As Long, ii As Long
Dim r As Long, NF As Long
Workbooks.Add
Range("A1").Select
Set ShApp = CreateObject("Shell.Application")
On Error Resume Next
With ShApp
Dto = .Browseforfolder(0, "Directorio a Listar", 0, "").Items.Item.Path
End With
On Error GoTo 0
If IsEmpty(Dto) = True Or Dto = "" Then GoTo Sies
With Range("A1")
.Value = Dto
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
hom:
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
With ActiveCell
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
Next
r = [A65536].End(xlUp).Row
A = Dir(Dto & "\", vbArchive)
Do
With ActiveCell
If A = "." Or A = ".." Or A = "" Then
Else
.Value = Dto & "\" & A
.Offset(1, 0).Select
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Set T = Nothing
If r = 1 Then GoTo Sies
For i = 1 To r
Dto = Cells(i, 1).Value
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
With ActiveCell
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
Next
A = Dir(Dto & "\", vbArchive)
Do
With ActiveCell
If A = "." Or A = ".." Or A = "" Then
Else
.Value = Dto & "\" & A
.Offset(1, 0).Select
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Next
Set T = Nothing
ii = r + 1
Cells(ii, 1).Select
Do
ree:
Cells(ii, 1).Select
If ActiveCell.Row = [A65536].End(xlUp).Row Or ActiveCell.Row = 65535 Then GoTo ESEL
If CBool(ActiveCell.Font.ColorIndex = 3) = True Then
Dto = Cells(ii, 1).Value
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
NF = [A65536].End(xlUp).Row + 1
With Range("A" & NF)
.Select
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
End With
Next
A = Dir(Dto & "\", vbArchive)
Do
NF = [A65536].End(xlUp).Row + 1
With Range("A" & NF)
If A = "." Or A = ".." Or A = "" Then
Else
.Select
.Value = Dto & "\" & A
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Set T = Nothing
ii = ii + 1
GoTo ree
Else
ii = ii + 1
GoTo ree
End If
ESEL:
Loop Until CBool(ActiveCell.Font.ColorIndex = 3) = False Or ActiveCell.Row = [A65536].End(xlUp).Row
Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess ', _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sies:
MsgBox "ALL READY"
End Sub
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

Objetos Filelist-and-SubFolder List

Publicado por Tinno (2 intervenciones) el 14/09/2010 23:24:54
Option Explicit

Sub NEWOFNEW()
Rem create today 14/09/2010 for Tinno
Rem in Excel of course
Dim FSO As New FileSystemObject
Dim T As Object, ShApp As Object
Dim Dto As String
Dim f, A
Dim i As Long, ii As Long
Dim r As Long, NF As Long
Workbooks.Add
Range("A1").Select
Set ShApp = CreateObject("Shell.Application")
On Error Resume Next
With ShApp
Dto = .Browseforfolder(0, "Directorio a Listar", 0, "").Items.Item.Path
End With
On Error GoTo 0
If IsEmpty(Dto) = True Or Dto = "" Then GoTo Sies
With Range("A1")
.Value = Dto
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
hom:
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
With ActiveCell
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
Next
r = [A65536].End(xlUp).Row
A = Dir(Dto & "\", vbArchive)
Do
With ActiveCell
If A = "." Or A = ".." Or A = "" Then
Else
.Value = Dto & "\" & A
.Offset(1, 0).Select
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Set T = Nothing
If r = 1 Then GoTo Sies
For i = 1 To r
Dto = Cells(i, 1).Value
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
With ActiveCell
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
.Offset(1, 0).Select
End With
Next
A = Dir(Dto & "\", vbArchive)
Do
With ActiveCell
If A = "." Or A = ".." Or A = "" Then
Else
.Value = Dto & "\" & A
.Offset(1, 0).Select
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Next
Set T = Nothing
ii = r + 1
Cells(ii, 1).Select
Do
ree:
Cells(ii, 1).Select
If ActiveCell.Row = [A65536].End(xlUp).Row Or ActiveCell.Row = 65535 Then GoTo ESEL
If CBool(ActiveCell.Font.ColorIndex = 3) = True Then
Dto = Cells(ii, 1).Value
Set T = FSO.GetFolder(Dto).SubFolders
For Each f In T
NF = [A65536].End(xlUp).Row + 1
With Range("A" & NF)
.Select
.Value = Dto & "\" & f.Name
.Font.ColorIndex = 3
End With
Next
A = Dir(Dto & "\", vbArchive)
Do
NF = [A65536].End(xlUp).Row + 1
With Range("A" & NF)
If A = "." Or A = ".." Or A = "" Then
Else
.Select
.Value = Dto & "\" & A
End If
End With
On Error Resume Next
A = Dir()
On Error GoTo 0
Loop Until A = ""
Set T = Nothing
ii = ii + 1
GoTo ree
Else
ii = ii + 1
GoTo ree
End If
ESEL:
Loop Until CBool(ActiveCell.Font.ColorIndex = 3) = False Or ActiveCell.Row = [A65536].End(xlUp).Row
Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess ', _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sies:
MsgBox "ALL READY"
End Sub
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

RE:Objetos Dirlist-Drivelist-Filelist

Publicado por Freddy (1 intervención) el 19/12/2007 01:39:23
quiero saber todo sobre Dirlist - Drivelist - Filelist , como se utliza, como funciona, ejemplos, etc. porfa me podrian ayudar en este trabajo
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

Unidad 1

Publicado por jrodriguez (1 intervención) el 10/11/2009 00:08:38
Introducción

Objetivos
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
sin imagen de perfil
Val: 14
Ha aumentado 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

por fin..

Publicado por SuNcO (599 intervenciones) el 08/07/2005 00:57:35
Me tarde un poco pero aqui esta :

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_LWIN = &H5B
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_APPS = &H5D

Private Sub Command1_Click()
Dim VK_ACTION As Long

VK_ACTION = &H45

Call keybd_event(VK_LWIN, 0, 0, 0)
Call keybd_event(VK_ACTION, 0, 0, 0)
Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
End Sub
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

Super bien ese codigo, y Aprovecho tambien.

Publicado por Loud_in (110 intervenciones) el 08/07/2005 01:05:40
Algunas ocasiones, he necesitado listar solo las carpetas para seleccionar una carpeta.

Obviamente lo haz visto es un cuadro de dialogo que es para seleccionar la carpeta o para descargar en la carpeta. lo vez normalmente cuando vas a extraer aun .zip pero con el prg de Windows. he intentado con los flags del commondialog, y con todas las combinaciones posibles y conclui que ese cuadro de dialogo, no lo proporciona el Comm....

Gracias

Andres-Loud_in
Medellin-Colombia
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
sin imagen de perfil
Val: 14
Ha aumentado 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

RE:Super bien ese codigo, y Aprovecho tambien.

Publicado por SuNcO (599 intervenciones) el 08/07/2005 01:13:37
Ese tambien lo tengo =P

Solo ocupas poner un Boton y :

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = vbNullString
End If
End Function

Private Sub Command1_Click()
Text1 = BrowseFolder("Selecciona un directorio")
End Sub
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

Hey bien Gracias.

Publicado por Loud_in (110 intervenciones) el 08/07/2005 16:26:39
Hey bien Gracias.
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

RE:abrir carpeta

Publicado por Juan_K (181 intervenciones) el 08/07/2005 01:56:41
Esto tambien funciona ppara abrir MiPC
Shell "explorer.exe file:///"
o el drive q deseen
Shell "explorer.exe H:\carpeta1"
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

RE:abrir carpeta

Publicado por Carlos (2 intervenciones) el 22/10/2007 01:40:50
hey esta mejor el tuyo, un poco simple he de decir, pero esta weno... solamente una adicion mas...

x = Shell ( "explorer.exe H:\carpeta1", vbmaximized)

para que este maximizada, o agregarle un enfoque para que este visible....
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