Thread: Reopen workbook
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Reopen workbook

Maybe you can use application.ontime to run a do-nothing macro. As long as
excel is open (not necessarily your workbook), excel will reopen a workbook to
run that macro.

Option Explicit
Sub testme()

Application.OnTime Now + TimeSerial(0, 0, 1), _
"'" & ThisWorkbook.Name & "'!DummyMac"

ThisWorkbook.Close savechanges:=False

End Sub
Sub DummyMac()
'uncomment this line for testing???
'MsgBox "hi"
End Sub

Depending on your security settings, you may get prompted to allow macros to
open.

You may want to take a look at Chip Pearson's notes:
http://www.cpearson.com/excel/OnTime.aspx


Weeepie wrote:

Hello,

I want to reopen a workbook trough VBA without saving.

But when I close then I lose my code and it does'nt continue.

I've tried this

Dim Pad As String
Pad = ActiveWorkbook.Path
ActiveWorkbook.Close SaveChanges:=False
Workbooks.Open Pad

Thx for helping me out

Weeepie


--

Dave Peterson