ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to determine if an excel Excel was open by code (automation) ormanually, by a human user (https://www.excelbanter.com/excel-programming/414366-how-determine-if-excel-excel-open-code-automation-ormanually-human-user.html)

Radu

How to determine if an excel Excel was open by code (automation) ormanually, by a human user
 
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 ?

Thank you very much
Alex.

Héctor Miguel

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.



Otto Moehrbach[_2_]

How to determine if an excel Excel was open by code (automation) or manually, by a human user
 
In the code that will open the file (by automation) bracket the file open
command with:
Application.EnableEvents=False
'your file open command goes here
Application.EnableEvents=True
HTH Otto
"Radu" wrote in message
...
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 ?

Thank you very much
Alex.




Radu

How to determine if an excel Excel was open by code (automation)or manually, by a human user
 
Wow ! Great tips, guys ! Thanks a lot - tomorrow I'll try both
solutions - first thing in the morning.

Thanks again, and have a great day !
Radu


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com