View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Is there an "OnOpen" event for Excel

If you name the macro Auto_Open, it will execute whenever Excel
is opened by the user (it will not run if the workbook is opened
via VBA). If you use the Workbook_Open macro in the ThisWorkbook
module, that procedure will run whenever the file opens, either
by the user or by VBA.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jurrasicway" wrote in
message
...
Hi,
I wish to display a message box when a user opens the
spreadsheet. How do I
make my message box code run? I have tried the following but it
does not seem
to work:

Sub DisplayMessageBox()
If Sheet("Price Change Request").active = True Then
MsgBox "hello"
End if
End Sub

How do I trigger this sub routine or is there an "OnOpen" event
that I can
attach my code to?

Graeme.