Open Specific File

D

DB100

Hi All

I have been tinkering with this for a while and am hoping someone ma
be able to help.

I have created a userform that will enter three pcs of information o
to a Spreadsheet, into Cells A1 to A3. Name - Month - Group. ( Al
three are obviously variables, depending on who enters the informatio
)

The spreadsheet then pools this information into cells A4 an
automatically saves the file as NAME-MONTH-GROUP.xls.

The problem I have is that I want the user to be able to use anothe
userform to be able to retrive their file. All the files are saved i
the same place, I am just not quite sure of the code to retrieve them

Thanks for any hel
 
M

mudraker

Why not use the same form with a button to save and another button t
open

You would then only need to use the workbook open command once the use
has entered the relavant info into the text boxes

Try

Sub fffff()
Dim sFile As String
sFile$ = Range("a4").Value
If sFile = "" Then
Exit Sub
End If
If Dir(sFile) = "" Then
MsgBox "File Not Found"
' or use
sFile$ = Application.GetOpenFilename("Excel Files (*.*),*.xls")
If sFile = False Then
Exit Sub
End If
End If
Workbooks.Open FileName:=sFile

End Su
 
D

DB100

Hi Mudraker

Sorry I think I am having a Monday moment. What you have makes sense
but I am struggling to incororate it into what I have already.

This is the code I have been using to save the filr.

Thanks

David

Private Sub CmndOK_click()
Workbooks.OpenText FileName:="U:\scorecard.xls", Origin:=xlWindows
ActiveWorkbook.Sheets("SCORECARD").Activate
Range("B1").Select

ActiveCell.Value = txtname.Value
ActiveCell.Offset(1, 0) = Cmbgroup.Value
ActiveCell.Offset(2, 0) = cmbmonth.Value
ActiveCell.Offset(3, 0) = Txtstart.Value

Range("F1").Select
ActiveWorkbook.SaveAs FileName:=Range("F1").Value & ".xls"
Unload Me
End Su
 
Top