Help RE: 2 Private Sub Workbook_Open() CODES

cbryan15

New Member
Joined
Mar 5, 2013
Messages
24
Hi everybody!

I would like to seek for you help regarding my problem. I would like to use two codes for Private Sub Workbook_Open() but I do not know how to do it. My codes are the following:

Code:
Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
and
Code:
    Dim Edate As Date    Edate = Format("xx/xx/xxxx", "DD/MM/YYYY")
    If Date > Edate + 2 Then
    MsgBox "This file is corrupted and will now close."
    ActiveWorkbook.Close
    End If
End Sub

Kindly help me. Appreciate it a lot!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This should do it for you... Not sure about the date so I changed it to show the current date.

Code:
Private Sub Workbook_Open()

    Dim Edate As Date

    Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"

    Edate = Format(Now(), "DD/MM/YYYY")
    If Date > Edate + 2 Then
        MsgBox "This file is corrupted and will now close."
        ActiveWorkbook.Close
    End If

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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