Auto Open Excel

D

David Kemp

Hi All,

Hope some of you are still around!
I tried using this as well but got an error.

-----------------------------------------------------CODE
Sub OpenWorkbooks()
Dim myBook As Workbook

Set myBook = Workbooks.Open(Filename:="C:\Documents and
Settings\kempdav1\My Documents\FBR\FBR Report v5 7075005.xls")
With myBook
Application.Run myBook.Name & "!Auto_Open"
.Close SaveChanges:=True
End With

Set myBook = Workbooks.Open(Filename:="C:\Documents and
Settings\kempdav1\My Documents\FBR\FBR Report v5 7051008.xls")
With myBook
Application.Run myBook.Name & "!Auto_Open"
.Close SaveChanges:=True
End With

Set myBook = Nothing
End Sub

--------------------------------------------------ENDCODE

I get the error:- run time error 1004
The macro 'FBR Report v5 7075005.xls!Auto_Open' cannot be found.

I am not big on coding or excel so its probably something obvious, any
ideas would be much appeciated.

Many thanks,

David
 
D

Dave Peterson

Maybe it's those pesky spaces...

Application.Run "'" & myBook.Name & "'!Auto_Open"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top