I have a spreadsheet that only requires links to be updated once daily,and that would be when the previous days data is entered.This takes place between midnight and 5 am each morning.The file is a little slow to update so most users select NO when prompted.I'm trying to get a code to work that will,when opening,automatically update without prompted the user if it's being opened between midnight and 5am.Anytime the file is opened outside of these hours,give the user the normal option to update or not to. The following code is what I have so far (Thanks to other forum gurus) but I keep getting a Compile error:Sub or function not defined.I opened the project explorer and inserted the code in "this workbook" code window.I'm using excel 2007.Here's the code as it is now:
Code:
'When the workbook is opened
Private Sub Workbook_Open()
'If the current time is between 12:00 and 5:00
If Hour(Time) >= 0 And Hour(Time) < 5 Then
MsgBox "yes"
'User has to update links
linkUpdate
Else
'Ask user to update links
ans = MsgBox("Do you wish to update the links?", vbYesNo, "Update Links")
'If user clicks yes to updating links
If ans = vbYes Then
'Update the links
linkUpdate
End If
End If
End Sub