View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Héctor Miguel Héctor Miguel is offline
external usenet poster
 
Posts: 434
Default How to determine if an excel Excel was open by code (automation) or manually, by a human user


hi, Radu !

Hi. An excel file is opened by people, but also by code from a VB application.
I would like the code in Workbook_Open to run whenever the file is opened by a human
but not to run when the file is opened by automation.
Any ideas ?


(i.e.)

Private Sub Workbook_Open()
If Not Application.UserControl Then Exit Sub
' here your normal actions ...'
End Sub

hth,
hector.