Imagine this condition; We are in the middle of doing something using Excel VBA macro, then we want the macro to automatically show the File Open dialog box to make us (user) able to choose another Excel file to be opened by Excel.
Got the picture? Below is vba procedure that do exactly like that, show the File Open dialog box, and open the Excel file selected by user.
Sub OpenExcelFile()
Dim vFile As Variant
'Showing Excel Open Dialog Form
vFile = Application.GetOpenFilename("Excel Files (*.xl*)," & _
"*.xl*", 1, "Select Excel File", "Open", False)
'If Cancel then exit
If TypeName(vFile) = "Boolean" Then
Exit Sub
End If
'Open selected file
Workbooks.Open vFile
End Sub
Thanks this works great. Is there also way to have the macro open a specfic xls file?
Hi Gary, if you just wanna open specific xl file, you can directly use workbooks.open “c:\xlfilename.xls” function.
Is there an easy way to open a non-excel file, based on the contents of the cell in an excel file.
For example, if i have a file
DP1253 – 50393.tif, can I open it automatically on a macro run if i have a cell (say A1) with a value DP1253
Thanks in advance
Hey I have a text file that I need to open with excel VBA macro creating loop. Each word will have to be placed in individual cells of the excel sheet.
Can anyone help?
hello friends , there is a window already opened at desktop , i usually control this window by keyboard,,,,like i type some numbers by keyboard on this window and then press enter and then i got the result.I want to make an excel macro which will automatically go to this opened window and then wil press the required number(like 1 , 2 and enter) and then i get get the result automatically , is this possible.Plz tell.
thanks in advance
I have read dozens of answers about opening another Excel file from a VBA macro, but none answer my problem. Here it is: I have a macro that runs perfectly (opens a file, processes the data, etc.) as long as I invoke the macro from the Macro window displayed by Alt-F8 or Tools->Macro->Macros. However, if I invoke the macro by a shortcut key, i.e., Ctl-Shift-U, the code following the Workbooks.Open statement never gets executed. Is this a bug in Excel, Windows, etc.? The same thing happens with Excel 2003 on Windows XP and with Excel 2007 on Windows 7.
Thanks a lot, could you please share how we could create macro to open Excel file in the same existing excel sheet that contains macro source..
Pingback: Prestashop Templates
Pingback: Graphics Work
Pingback: debt consolidation companies
Pingback: reverse mortgages calculator
Pingback: debt consolidation companies
Pingback: financial freedom reverse mortgage
Pingback: watch Superbowl online
Pingback: super bowl 2012
Pingback: ares free download