Vba Help Required

Premanshu

Board Regular
Joined
Oct 2, 2007
Messages
91
Hi,

I am actually creating a macro which when triggered will pull a specific file as per User's selection and perform certain tasks on that.

Can i instruct my macro such a way that when it is triggered a pop appears with a "Browse" button on it through which the user can browse into the system and locate the file he wants to be opened and worked upon by the macro.

Any help on this would be highly appreciated....


Thanks in advance...

Regards
Premanshu.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try something like this:
Code:
Sub Get_Data()

Dim wb1 As String

wb1 = ActiveWorkbook.Name

FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls (*.xls),")
''
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "No file"
Exit Sub
Else
Workbooks.Open FileName:=FileToOpen



End If
End Sub
 
Upvote 0
Code:
Sub tester()
    Filename = Application.GetOpenFilename()
    If Filename = 0 Then
        MsgBox ("Cancelled")
        Else: MsgBox (Filename)
    End If
End Sub

This should get you started
 
Upvote 0
Thank you so much Shyrath and Makrini....... you guys were a great help for me.
Shyrath i also went through your blog it's awesome mann. Looks like i am in touch of a excel champ.... would again trouble you if got stuck into something.

Thanks a lot again both of you guys....

God bless you....

Premanshu
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,509
Members
449,089
Latest member
RandomExceller01

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