Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Opening a xl workbook using wildcard
Hi,
I am using an input box to to select a folder for where the .xls workbook is ########## Sub Macro3() Dim i As String i = InputBox("Enter Job Number", , "Job Number") Workbooks.Open Filename:="C:\" & i & "\Kicking Quotes.xls" End Sub ######### Each folder has 1 workbook but the workbook does not always have the same name. How can I open whatever workbook is in the folder selected? Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Opening a xl workbook using wildcard
This opens the first XLS file that the Dir function returns:
Sub a() Dim DName As String Dim FName As String DName = InputBox("Enter Job Number", , "Job Number") If DName < "" Then FName = Dir("C:\" & DName & "\*.xls") If FName < "" Then Workbooks.Open "C:\" & DName & "\" & FName End If End If End Sub -- Jim "damorrison" wrote in message ... | Hi, | I am using an input box to to select a folder for where the .xls | workbook is | ########## | Sub Macro3() | Dim i As String | i = InputBox("Enter Job Number", , "Job Number") | Workbooks.Open Filename:="C:\" & i & "\Kicking Quotes.xls" | End Sub | | ######### | Each folder has 1 workbook but the workbook does not always have the | same name. | | How can I open whatever workbook is in the folder selected? | | Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Opening a xl workbook using wildcard
On Sep 23, 5:22*am, "Jim Rech" wrote:
This opens the first XLS file that the Dir function returns: Sub a() * * Dim DName As String * * Dim FName As String * * DName = InputBox("Enter Job Number", , "Job Number") * * If DName < "" Then * * * * FName = Dir("C:\" & DName & "\*.xls") * * * * If FName < "" Then * * * * * * Workbooks.Open "C:\" & DName & "\" & FName * * * * End If * * End If End Sub Thank You very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
opening a file with wildcard | Excel Discussion (Misc queries) | |||
when opening an Excel Workbook, another blank workbook also opens | Excel Discussion (Misc queries) | |||
when opening an Excel Workbook, another blank workbook also opens | Excel Discussion (Misc queries) | |||
Using a Wildcard (*) in formula accessing sheets in workbook. | Excel Worksheet Functions | |||
Opening workbook | Excel Discussion (Misc queries) |