Opening Files Using Visual Basic

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467
Hi guys,

I've started to dabble a little with Visual Basic 6 and I'm struggling with something.

I've managed to make a Common Dialog Box that shows a window to open other files.

When you click on a file and click "Open" nothing happens. Obviously I need to add some code.

Can anyone tell me what code I need to add because I can't figure out how to open files using VB.

I want it to be able to open any file using the file's default program to open.

Can anybody help me?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Here is some code I frequently use:
Code:
    myfile = Application.GetOpenFilename("All Files,*.*")
    If myfile = False Then
        Exit Sub
    End If
    Workbooks.Open Filename:=myfile
 
Upvote 0
Oops!

I've just noticed I've posted this in the wrong forum.

I'm actually using Visual Basic 6 and not the VB in Excel.

I'm sorry for any confusion. Could somebody move this for me or should I post a fresh topic on the correct board?
 
Upvote 0

Forum statistics

Threads
1,224,903
Messages
6,181,659
Members
453,059
Latest member
jkevin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top