Hi all,

A question please.

I have a master workbook. On a form is a commandbutton that opens a second file.
When the second workbook opens, my form disappears (automatically), the form from the second file appears.
I have placed this event in workbook.open.

When I close the second file, I see again the first workbook, but with no form.
I need the orginally form to be shown.

Can someone help please?



Private Sub Commandbuttonfile_Click()

Dim bn As String
    bn = Application.GetOpenFilename("Excel-files,*.xls*", _
        1, "Select One File To Open", , False)
    If TypeName(bn) = "Boolean" Then Exit Sub

TextBox2 = bn

Dim BackSlash As Integer, Point As Integer
Dim FilePath As String, FileName As String
Dim i As Integer
  
FilePath = bn
For i = Len(FilePath) To 1 Step -1
If Mid$(FilePath, i, 1) = "." Then
     Point = i
     Exit For
    End If
  Next i
  If Point = 0 Then Point = Len(FilePath) + 1
  For i = Point - 1 To 1 Step -1
    If Mid$(FilePath, i, 1) = "\" Then
      BackSlash = i
      Exit For
    End If
  Next i
  FileName = Mid$(FilePath, BackSlash + 1, Point - BackSlash - 1)
  
TextBox3 = FileName

end sub


Private Sub Commandbuttonfileopen_Click()

TextBox1 = ActiveWorkbook.Name

Dim strb1 As String
Dim strb2 As String

strb1 = TextBox1
strb2 = TextBox3
Unload frmstart

    Workbooks.Open strb2

end sub