ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using commondialog.showopen (https://www.excelbanter.com/excel-programming/330955-using-commondialog-showopen.html)

Didier Poskin

Using commondialog.showopen
 
Hi,

I was wondering, is there a way to retreive only a path using the showopen
window?

I use the following sub:

Private Sub CreateMDSFilesButton_Click()
On Error GoTo err
CommonDialog1.DialogTitle = "Set MDS save directory"
CommonDialog1.Filename = ""
CommonDialog1.Filter = "*.*"
CommonDialog1.ShowOpen
Call assignparam("MDS Directory:", CurDir & "\") ' this write the directory
name in a cell where I can retreive it later
Call CreateMDSfiles ' this creates the new files in 'CurDir\'
Exit Sub

err:
If err.Number = 32755 Then Exit Sub ' cancel button has been used : nothing
needs be done
MsgBox (err.Number)
Resume Next
End Sub


Here is what happens: I want to create a number of files in a directory.
If there are files in the directory then my sub works, the problem comes
when there are no files at all in the directory or a create a new one (using
rightclicknew folder): the window will not close if a file is not
selected. A workaround is to create empty txt file (using
rightclicknewtextfile)but I would not call this a nice solution.

Any idea would be more then welcome.

Thanks,

Didier





Robert Bruce[_2_]

Using commondialog.showopen
 
Roedd <<Didier Poskin wedi ysgrifennu:

Hi,

I was wondering, is there a way to retreive only a path using the
showopen window?


I think you want the BrowseFro Folder dialog:
http://www.cpearson.com/excel/BrowseFolder.htm

--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.



Andy Wiggins[_6_]

Using commondialog.showopen
 
Here's what you want:

http://www.bygsoftware.com/Excel/VBA/file_dialog.htm

--
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy

-

"Didier Poskin" wrote in message
...
Hi,

I was wondering, is there a way to retreive only a path using the showopen
window?

I use the following sub:

Private Sub CreateMDSFilesButton_Click()
On Error GoTo err
CommonDialog1.DialogTitle = "Set MDS save directory"
CommonDialog1.Filename = ""
CommonDialog1.Filter = "*.*"
CommonDialog1.ShowOpen
Call assignparam("MDS Directory:", CurDir & "\") ' this write the

directory
name in a cell where I can retreive it later
Call CreateMDSfiles ' this creates the new files in 'CurDir\'
Exit Sub

err:
If err.Number = 32755 Then Exit Sub ' cancel button has been used :

nothing
needs be done
MsgBox (err.Number)
Resume Next
End Sub


Here is what happens: I want to create a number of files in a directory.
If there are files in the directory then my sub works, the problem comes
when there are no files at all in the directory or a create a new one

(using
rightclicknew folder): the window will not close if a file is not
selected. A workaround is to create empty txt file (using
rightclicknewtextfile)but I would not call this a nice solution.

Any idea would be more then welcome.

Thanks,

Didier






Didier Poskin

Using commondialog.showopen
 
Hi,

Thanks, not the way I expected it... but fine anyway.

Thanks again,

Didier

"Robert Bruce" <rob@analytical-dynamicsdotcodotukay a écrit dans le message
de news: ...
Roedd <<Didier Poskin wedi ysgrifennu:

Hi,

I was wondering, is there a way to retreive only a path using the
showopen window?


I think you want the BrowseFro Folder dialog:
http://www.cpearson.com/excel/BrowseFolder.htm

--
Rob

http://www.asta51.dsl.pipex.com/webcam/

This message is copyright Robert Bruce and intended
for distribution only via NNTP.
Dissemination via third party Web forums with the
exception of Google Groups and Microsoft Communities
is strictly prohibited and may result in legal action.





Didier Poskin

Using commondialog.showopen
 
Hi,

Thanks a lot for your effective answer.
There are so many different ways to get what you want...in VBA
I still feel like I don't know anything but I keep on working.

Thanks again for your help,

Didier

Didier
"Andy Wiggins" a écrit dans le message
de news: ...
Here's what you want:

http://www.bygsoftware.com/Excel/VBA/file_dialog.htm

--
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy

-

"Didier Poskin" wrote in message
...
Hi,

I was wondering, is there a way to retreive only a path using the
showopen
window?

I use the following sub:

Private Sub CreateMDSFilesButton_Click()
On Error GoTo err
CommonDialog1.DialogTitle = "Set MDS save directory"
CommonDialog1.Filename = ""
CommonDialog1.Filter = "*.*"
CommonDialog1.ShowOpen
Call assignparam("MDS Directory:", CurDir & "\") ' this write the

directory
name in a cell where I can retreive it later
Call CreateMDSfiles ' this creates the new files in 'CurDir\'
Exit Sub

err:
If err.Number = 32755 Then Exit Sub ' cancel button has been used :

nothing
needs be done
MsgBox (err.Number)
Resume Next
End Sub


Here is what happens: I want to create a number of files in a directory.
If there are files in the directory then my sub works, the problem comes
when there are no files at all in the directory or a create a new one

(using
rightclicknew folder): the window will not close if a file is not
selected. A workaround is to create empty txt file (using
rightclicknewtextfile)but I would not call this a nice solution.

Any idea would be more then welcome.

Thanks,

Didier









All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com