Hi all,
I am trying to combine two seperate bits of code that I have in diffrent workbooks in a new one I am doing. However I cannot seem to combine them under one Workbook open() functions. I cant do two sepearte ones as it gives me an ambiguous error.
Here are the two codes I am trying to combine. Please help, much in need on this one.
Thanks for the help everyone
I am trying to combine two seperate bits of code that I have in diffrent workbooks in a new one I am doing. However I cannot seem to combine them under one Workbook open() functions. I cant do two sepearte ones as it gives me an ambiguous error.
Here are the two codes I am trying to combine. Please help, much in need on this one.
Code:
Private Sub Workbook_Open()
Sheets("database").Select
Range("au16").Select
dtmSchedule = Now + TimeValue("00:15:00")
Application.OnTime dtmSchedule, "TimeOut"
If ThisWorkbook.ReadOnly Then
MsgBox ("The file is currently being used by another user, please contact them to ensure they have not left the file open.")
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime dtmSchedule, "TimeOut", , False
End Sub
Code:
Option Explicit
Private Sub Workbook_Open()
With Worksheets("PP")
.Protect Password:="bargy", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub
Thanks for the help everyone