Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel file seems to open but does not display | Excel Discussion (Misc queries) | |||
open csv file, display format | Excel Discussion (Misc queries) | |||
Open an excel file but it does not display | Excel Discussion (Misc queries) | |||
How do I display each Excel file I open in the task bar | Excel Discussion (Misc queries) | |||
How to display an open file? | Excel Programming |