============================================== Sub OpenFile (Filename As String) Dim F As Integer If "Text Editor: " + Filename = frmEditor.Caption Then ' Avoid opening the file if already loaded. Exit Sub Else On Error GoTo ErrHandler F = FreeFile Open Filename For Input As F ' Open file selected on File Open About. frmEditor!txtEdit.Text = Input$(LOF(F), F) Close F ' Close file. frmEditor!mnuFileItem(3).Enabled = True ' Enable the Close menu item UpdateMenu frmEditor.Caption = "Text Editor: " + Filename Exit Sub End If ErrHandler: MsgBox "Error encountered while trying to open file, please retry.", 48, "Text Editor" Close F Exit Sub End Sub