Forum Discussion
John_McDonald_081301
May 17, 2024Copper Contributor
Excel Auto Open Macro
I bought a book on VBA programming for MS Office and I'm trying to do one of the examples. It's a macro that automatically maximizes the window and opens the most recent document when you start excel, but it's not working. There is no error message, excel just opens like normal. I've gone through the instructions a couple of times but can't find any issues. My code is below:
Option Explicit
Private Sub Auto_Open()
Application.WindowState = xlMaximized
Application.RecentFiles(1).Open
End Sub
Any thoughts? Thanks in advance.
4 Replies
Sort By
- JKPieterseSilver ContributorWhere exactly did you place the code?
- John_McDonald_081301Copper Contributor
Change the name Auto_Open to Workbook_Open