excel and VB Open Dialog box

G

Guest

Hi guys,

I want to add an Open Dialog Box in an excel file, so the user can browse
for a csv file and then add it as a worksheet in the original excel file.

It's going to be like this:
1. The excel file (called main.xls) has 4 Open Dialog Boxes.
2. When the user clicks on the 'Browse' button beside the first dialog box,
he can browse for a csv file.
3. Let's say he chose a csv file named file1.csv... this csv file will be
saved in a worksheet of main.xls.

How do I go about this? Please start with how I can create a Dialog Box.

Thanks!
 
G

Guest

Hi guys,

I want to add an Open File Dialog Box in an excel file, so the user can
browse
for a csv file and then add it as a worksheet in the original excel file.

It's going to be like this:
1. The excel file (called main.xls) has 4 Open Dialog Boxes.
2. When the user clicks on the 'Browse' button beside the first dialog box,
he can browse for a csv file.
3. Let's say he chose a csv file named file1.csv... this csv file will be
saved in a worksheet of main.xls.

How do I go about this? Please start with how I can create an Open File
Dialog Box.

Thanks!
 
H

Harald Staff

Sub test()
Dim F As Variant
F = Application.GetOpenFilename("csv Files (*.csv), *.csv")
If F = False Then Exit Sub
Workbooks.Open F
End Sub

HTH. Best wishes Harald
 

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