View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] adambush4242@hotmail.com is offline
external usenet poster
 
Posts: 168
Default Open a File and Run AutoOpen Macro

Dave,

The problem is I need to close the first workbook and then continue to run
code, so I can't do all this from the first workbook.

Bernie,

I tried your idea with the exact same results.

Any more ideas?

Thanks

Adam Bush

"Dave Peterson" wrote:

Why not just have the workbook_open() event in the first workbook close that
workbook?

Option Explicit
Private Sub Workbook_Open()

dim wkbk as workbook
set wkbk = workbooks.open(filename:="s:\ome\other\work\book.x ls")

me.close savechanges:=false

End Sub




wrote:

I'm trying to use workbook.open to open another file and then I want this
other file to automatically run a macro. This other macro starts by closing
out the original file and then running a bunch of other code. I tried using
a Workbook_Open sub but as soon as the code closes the original file it just
stops running. I've tried everything I can think of but I cannot come up
with a solution. I need to open a specified file, then use this file to
close the original and run other code. Any ideas?

Thanks

Adam Bush


--

Dave Peterson