Display the Browse for Folder Dialog

N

nicoflowers

Hello,

I made a VBA EXCEL program which can open, write and close a file
(.xml), I would like to know how to do so when I click on a
"CommandButton", a window appears which display the brtowse for folder
dialog

Kinds regards.

For now :
Private Sub CreateFile(Line As String)
Dim FileName As String
Dim NewLine As String
Dim X As String, w As String, RulesInform As String

Rulename = TextBox11.Value

X = Rulename
w = ".xml"

RulesInform = X & w


FileName = "C:\Documents and Settings\q737318\Desktop\AuToRules
\RESULT1\" & RulesInform
Dim FileNum As Integer
FileNum = FreeFile
NewLine = ReplaceTag(Line)
Open FileName For Append As #FileNum ' creates the file if it
doesn't exist
Print #FileNum, NewLine ' write information at the end of the text
file
Close #FileNum ' close the file
End Sub
 
S

Smart Akhtar

Hi nic

use this code to see the folders browser window
and select the folder as per your need.

Application.FileDialog(msoFileDialogFolderPicker).InitialFileName = "C:
\" ' Give your own path"
Application.FileDialog(msoFileDialogFolderPicker).Show
 
S

shiro

I'm sorry,
I used your code but it doesn't make a sense.
How to write it.


Hi nic

use this code to see the folders browser window
and select the folder as per your need.

Application.FileDialog(msoFileDialogFolderPicker).InitialFileName = "C:
\" ' Give your own path"
Application.FileDialog(msoFileDialogFolderPicker).Show
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top