I have some code that opens up another workbook (reminder.xlsm) and reports some status from the other workbook (which is password protected) and then closes it unless user wishes to open it via a msgbox. It all works great but the problem is that after a period of time of being open (lets say half hour to an hour), it attempts to re-open the reminder.xlsm sheet asking for the password. I am quite confused why if anyone can help it would be much appreciated.
VBA Code:
'Adding in nuisance reminder
If Worksheets("Measure Sheet").Range("G4").Value > "" Then 'Testing for job name and bypassing reminder if so
Exit Sub
Else
Application.DisplayAlerts = False
Application.ScreenUpdating = False
If fso.FileExists(ThisWorkbook.Path & "\..\Common\" & "Reminder.xlsm") Then 'Testing for existance of reminder.xlsm
Dim y As Workbook
Set y = Workbooks.Open(ThisWorkbook.Path & "\..\Common\" & "Reminder.xlsm", Password:="nope") 'Opening reminder.xlsm and checking or any "pending" status
y.Visible = False ' Hiding Reminder as it checks
If y.Sheets("All").Range("AB5").Value = 0 Then
y.Close SaveChanges:=False
GoTo Cont2
Else
Application.DisplayAlerts = False
Application.ScreenUpdating = False
msg = "You have " & wkb.Sheets("All").Range("AB5") & " pending reminders - Would you like to view them now?"
y.Close SaveChanges:=False
Application.ScreenUpdating = True
Prmt = MsgBox(msg, vbCritical + vbYesNo, "Nuisance Reminder")
If Prmt = vbNo Then
GoTo Cont2
Else
Set y2 = Workbooks.Open(ThisWorkbook.Path & "\..\Common\" & "LaunchReminder.xlsm")
y2.Close SaveChanges
End If
End If
Else
msg = "The \Dropbox\Prefab\Common file Reminder.xlsm is either corrupt or missing"
Prmt = MsgBox(msg, vbCritical + vbOKOnly, "Missing recommended file")
Cancel = True
Exit Sub
End If
End If