CommonDialog
No se como se utiliza un CommonDialog para que me abra la ventana de explorar para indicar dónde guardar un fichero.
Alguien me podría ayudar??
Gracias
Alguien me podría ayudar??
Gracias
oks..
Dim sArchivo As String
With CommonDialog1
.DialogTitle = "Titulo de la Ventana de Dialogo"
.FileName = ""
.DefaultExt = "*.txt"
.Filter = "(*.txt)|*.txt|Todos los archivos (*.*)|*.*"
.FilterIndex = 0
.Flags = cdlOFNExplorer + cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + cdlOFNOverwritePrompt
.ShowSave
sArchivo = .FileName
End With
MsgBox sArchivo
donde CommonDialog1 es tu control CommonDialog, este ejemplo filtra solo para archivos "txt", debes cambia las propiedades para guardar otro tipo de archivos..
sArchivo al final contiene el Path y el nombre del Archivo..
Nota. debes agregar el Componente Microsoft Common Dialog Control 6.0
salu2
Dim sArchivo As String
With CommonDialog1
.DialogTitle = "Titulo de la Ventana de Dialogo"
.FileName = ""
.DefaultExt = "*.txt"
.Filter = "(*.txt)|*.txt|Todos los archivos (*.*)|*.*"
.FilterIndex = 0
.Flags = cdlOFNExplorer + cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + cdlOFNOverwritePrompt
.ShowSave
sArchivo = .FileName
End With
MsgBox sArchivo
donde CommonDialog1 es tu control CommonDialog, este ejemplo filtra solo para archivos "txt", debes cambia las propiedades para guardar otro tipo de archivos..
sArchivo al final contiene el Path y el nombre del Archivo..
Nota. debes agregar el Componente Microsoft Common Dialog Control 6.0
salu2
No me funciona. El codigo es este:
Dim cd_guardar As CommonDialog
Dim sArchivo As String
With cd_guardar
.DialogTitle = "Titulo de la Ventana de Dialogo"
.FileName = ""
.DefaultExt = "*.txt"
.Filter = "(*.txt)|*.txt|Todos los archivos (*.*)|*.*"
.FilterIndex = 0
.Flags = cdlOFNExplorer + cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + cdlOFNOverwritePrompt
.ShowSave
sArchivo = .FileName
End With
MsgBox sArchivo
Y me da un error:
Run-time error '91':
Object variable or With block variable not set
No sé qué será. He agregado el Componente Microsoft Common Dialog Control 6.0.
Si alguien me puede ayudar...
Gracias
Dim cd_guardar As CommonDialog
Dim sArchivo As String
With cd_guardar
.DialogTitle = "Titulo de la Ventana de Dialogo"
.FileName = ""
.DefaultExt = "*.txt"
.Filter = "(*.txt)|*.txt|Todos los archivos (*.*)|*.*"
.FilterIndex = 0
.Flags = cdlOFNExplorer + cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + cdlOFNOverwritePrompt
.ShowSave
sArchivo = .FileName
End With
MsgBox sArchivo
Y me da un error:
Run-time error '91':
Object variable or With block variable not set
No sé qué será. He agregado el Componente Microsoft Common Dialog Control 6.0.
Si alguien me puede ayudar...
Gracias