MrExcel Publishing
Your One Stop for Excel Tips & Solutions

problem auto_open procedure

Posted by Luca Mondin on September 12, 2000 2:59 AM

I've this kind of problem.

I've written a routine (in Excel 97) that open another workbook (i.e. pippo.xls). In this workbook (pippo.xls) there is an event procedure (Workbook_Open()) in the Thisworkbook object.
With this event procedure I would to open new text file or copy/add some worksheets in other location but the procedure doesn't work.
Note: if I launch the event procedure from pippo.xls the routine works good.
The there is problem, when I open pippo.xls from another workbook.

Private Sub Workbook_Open()
Dim today As Stringtoday = Format(Now(), "dd-mm")
If Worksheets(1).Name = today
Then Exit Sub
Worksheets(1).Copy before:=Worksheets(1)Worksheets(1).Name = today

''''' at this point the procedure doesn't work because the new worksheet hasn't been added, and shapes are not ''''' selected

End If
End Sub

Many Thanks for your help.

Posted by Luca Mondin on October 26, 2000 4:46 AM

I've posted this question last month, but no one have responded yet. Pheraps my english is bad and I haven't explained good which is the problem.
Please let me know something-