Need some help with rogue VB code please

sp00kster

New Member
Joined
Nov 25, 2006
Messages
42
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
 
In that case, I'm afraid I have no idea.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
In that case, I'm afraid I have no idea.
Agree - I'm a neophyte at VB but this has me so confused mostly due to the fact I have multiple sheets that call up the Reminders workbook in the exact same fashion and have no problems with them. I have even tried set y = null after y.close it but still keeps popping up.

Anyway thx for your help
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top