title: Path/File Access error for LoginForm.show
body: <p>I am trying to create a login form for my workbook, I was all finished on the code side of things.</p>
  
  <p>I am getting a massive problem after enabling the code, it runs fine until the book is closed, upon re-opening the book I get a Path/File Access error, also it deletes all contents of the form, text boxes, labels, and togglebutton. It then states a mistmatch error on code tested fine before closing the book.</p>
  
  <p>I've narrowed it down to the code highlighted, specifically the <code>LoginForm.show</code>.</p>
  
  <p>Can someone suggest any actions at all?</p>
  
  <p><strong><em>Sheet9 (ListSheets)</em></strong></p>
  
  <pre><code>Option Explicit
  
  
  
  Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Range("k4:r8")) Is Nothing Then
  
  
      If Target.Value = "Ð" Then
      Target.Value = "Ï"
      Exit Sub
      End If
       If Target.Value = "x" Then Target.Value = "Ð"
      If Target.Value = "Ï" Then Target.Value = "x"
      If Target.Value = Empty Then Target.Value = "Ð"
  End If
  
  If Not Intersect(Target, Range("J4:J8")) Is Nothing Then
  If Target.Value = "Ð" Then
      Range("J" &amp; Target.Row &amp; ":r" &amp; Target.Row).Value = "Ï"
      Exit Sub
      End If
       If Target.Value = "x" Then Range("J" &amp; Target.Row &amp; ":r" &amp; Target.Row).Value = "Ð"
      If Target.Value = "Ï" Then Range("J" &amp; Target.Row &amp; ":r" &amp; Target.Row).Value = "x"
      If Target.Value = Empty Then Range("J" &amp; Target.Row &amp; ":r" &amp; Target.Row).Value = "Ð"
  End If
  End Sub
  </code></pre>
  
  <p><strong><em>This Workbook</em></strong></p>
  
  <pre><code>Option Explicit
  
  Private Sub Workbook_BeforeClose(Cancel As Boolean)
  closeworkbook
  End Sub
  
  Private Sub Workbook_Open()
  LoginForm.Show
  End Sub
  </code></pre>
  
  <p><strong><em>Assorted Macros</em></strong></p>
  
  <pre><code>Option Explicit
  
  Sub CheckUser()
  Dim UserRow, SheetCol As Long
  Dim SheetNm As String
  With Sheet9
  .Calculate
  
  If .Range("B7").Value = Empty Then 'Incorrect Username
      MsgBox "Please Enter a correct user name"
      Exit Sub
  End If
  
  If .Range("B6").Value &lt;&gt; True Then 'Incorrect password
      MsgBox "Please Enter a correct password"
      Exit Sub
  End If
  
  LoginForm.Hide
  .Range("B4,B5").ClearContents
  UserRow = .Range("B7").Value 'User Row
  
  For SheetCol = 11 To 18
  SheetNm = .Cells(3, SheetCol).Value 'Sheet Name
  If .Cells(UserRow, SheetCol).Value = "Ð" Then
      Sheets(SheetNm).Unprotect "123"
      Sheets(SheetNm).Visible = xlSheetVisible
  End If
  
  If .Cells(UserRow, SheetCol).Value = "Ï" Then
      Sheets(SheetNm).Protect "123"
      Sheets(SheetNm).Visible = xlSheetVisible
  End If
  
  If .Cells(UserRow, SheetCol).Value = "x" Then Sheets(SheetNm).Visible = xlVeryHidden
  Next SheetCol
  End With
  End Sub
  
  Sub closeworkbook()
  Sheet8.Activate
  Dim wksht As Worksheet
  For Each wksht In ThisWorkbook.Worksheets
  If wksht.Name &lt;&gt; "Login" Then wksht.Visible = xlSheetVeryHidden
  Next wksht
  ThisWorkbook.Save
  End Sub
  </code></pre>