grichey
10-19-2007, 12:15 PM
Hello.
This is my first post on the forum. Thanks for the help ahead of time. I have about 20 files all named similarly with ##- myfile.xls . I am trying to get my macro to open a file where the user can enter simply say 70 or 91 which will then open either 70- myfile.xls or 91- myfile.xls. I tried as seen below to just open it with the - myfile.xls a constant and the ## as a user entered variable. This is not working
ideas?
Here where I am code wise currently:
****************
'Inputbox for tab to generate
Dim DivVariable As String
DivVariable = InputBox("2 Div Number", "Enter Div Number", "")
Dim FileVariable As String
FileVariable = "F:\mydir\"DivVariable"- myfile.xls"
'
'Open All Files
ChDir "F:\mydir\"
Workbooks.Open Filename:= _
FileVariable, UpdateLinks:=0
Windows(DivVariable"- myfile.xls").Activate
*************************************************
This is my first post on the forum. Thanks for the help ahead of time. I have about 20 files all named similarly with ##- myfile.xls . I am trying to get my macro to open a file where the user can enter simply say 70 or 91 which will then open either 70- myfile.xls or 91- myfile.xls. I tried as seen below to just open it with the - myfile.xls a constant and the ## as a user entered variable. This is not working
ideas?
Here where I am code wise currently:
****************
'Inputbox for tab to generate
Dim DivVariable As String
DivVariable = InputBox("2 Div Number", "Enter Div Number", "")
Dim FileVariable As String
FileVariable = "F:\mydir\"DivVariable"- myfile.xls"
'
'Open All Files
ChDir "F:\mydir\"
Workbooks.Open Filename:= _
FileVariable, UpdateLinks:=0
Windows(DivVariable"- myfile.xls").Activate
*************************************************