EXCEL 2003 macro issue

  • Thread starter Thread starter Neil Holden
  • Start date Start date
N

Neil Holden

Hi all gurus, help would be appreciated if you can.

I have an excel workbook set on a scheldule and every night at 2 am it will
open, i need all the cells updating and the full excel workbook to close
after 15 seconds.

The code below asks me to save it, i need all this to be done automatically.

Public Sub Test_Me()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:15"), "CloseMe"
End Sub

Public Sub CloseMe()
Application.ActiveWorkbook.Close
End Sub
 
Hi,

Like this

Public Sub CloseMe()
ActiveWorkbook.Close savechanges:=True
End Sub


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
Try the below...True specifies that the workbook to be saved...

ActiveWorkbook.Close True
 
Hi guys, thanks for your help with this.

When i run the macro now it doesnt close excel down, it stays open?
 
What happens when you try the below....Save Changes set to False..

Public Sub Test_Me()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:15"), "CloseMe"
End Sub

Public Sub CloseMe()
Application.ActiveWorkbook.Close False
End Sub
 
Hi Jacob, it closes excel but not fully. An empty window of excel remains
once the macro runs? The trouble with this is, the file is still saying its
open?

Also how do i get the macro to automatically run when the excel sheet opens?
 
OK Try the below to quit excel after closing the file

ActiveWorkbook.Close True
Application.DisplayAlerts = False
Application.Quit

Use the Sheet Activate event which gets triggered when a sheet is activated///

Private Sub Worksheet_Activate()
End Sub

OR the workbook open event that gets triggered when the workbook gets open

Private Sub Workbook_Open()
End Sub
 
Hello, it works but only so much, it leaves excel open but closes the
workbook. I need the entire excel to close?

Thanks for your help with this.
 
Back
Top