![]() |
display file open box
I want a macro that will display the box that allows you to choose a file and
the open it. When I record the macro I get: Workbooks.Open Filename:= _ "C:\Documents and Settings\PC User\My Documents\Electricity Bill.xls" However, I wish the user to be abloe to choose the file and its location within the box and then continue running the rest of the macro. How do I do this? Thanks in advance. |
display file open box
Hi fullers, use GetOpenFilename
Sub test() Dim FName As Variant Dim wb As Workbook Dim MyPath As String Dim SaveDriveDir As String SaveDriveDir = CurDir MyPath = ThisWorkbook.Path ChDrive MyPath ChDir MyPath FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls") If FName < False Then Set wb = Workbooks.Open(FName) MsgBox "your code" wb.Close End If ChDrive SaveDriveDir ChDir SaveDriveDir End Sub -- Regards Ron De Bruin http://www.rondebruin.nl "fullers" wrote in message ... I want a macro that will display the box that allows you to choose a file and the open it. When I record the macro I get: Workbooks.Open Filename:= _ "C:\Documents and Settings\PC User\My Documents\Electricity Bill.xls" However, I wish the user to be abloe to choose the file and its location within the box and then continue running the rest of the macro. How do I do this? Thanks in advance. |
All times are GMT +1. The time now is 03:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com