Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Hi fellows!
I need know what method was used to open my workbook, that is, a mous click or a VBA workbooks.open. Is there any way to find out it? Thanks! Hermínio -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Herminio,
One way would be to use the Auto_Open event procedure to set a flag variable. Because Auto_Open is not called executed when a workbook is opened via VBA, it will run only when the workbook is opened manually. E.g., Dim OpenByUI As Boolean Sub Auto_Open() OpenByUI = True End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Herminio " wrote in message ... Hi fellows! I need know what method was used to open my workbook, that is, a mouse click or a VBA workbooks.open. Is there any way to find out it? Thanks! Hermínio. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Dear Chip.
Unfortunately I am using Excel 2000 and it looks like it does not support the Auto_Open event. The nearest one to that would be the Activate event, but this is executed after the Open, in both manual and VBA calls. Thank you anyway. Regards, Herminio. --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
In a standard module, create a sub with the name Auto_Open (don't do it in a
sheet module, thisworkbook module or a userform module). Dim OpenByUI As Boolean Sub Auto_Open() OpenByUI = True End Sub It is supported in xl5 to xl2003. -- Regards, Tom Ogilvy "Herminio " wrote in message ... Dear Chip. Unfortunately I am using Excel 2000 and it looks like it does not support the Auto_Open event. The nearest one to that would be the Activate event, but this is executed after the Open, in both manual and VBA calls. Thank you anyway. Regards, Herminio. --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Dears Tom and Chip.
I've created a standard module with an Auto_Open subroutine, as yo said, and, it’s true, that code is *only* executed when you open th workbook manually (mouse click or Enter key). Nevertheless the Auto_Open code is executed *after* the Workbook_Ope subroutine. That's too late, because the code I want to bypass, in cas of a "remote" VBA Workbooks.Open, resides inside the Workbook_Ope subroutine. So, the problem remains unsolved. Thank you any way. Regards, Herminio -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
If you want to avoid all of the workbook_open event, you could do this when you
open the workbook mechanically: application.enableevents = false workbooks.open filename:= .... application.enableevents = true "Herminio <" wrote: Dears Tom and Chip. I've created a standard module with an Auto_Open subroutine, as you said, and, it’s true, that code is *only* executed when you open the workbook manually (mouse click or Enter key). Nevertheless the Auto_Open code is executed *after* the Workbook_Open subroutine. That's too late, because the code I want to bypass, in case of a "remote" VBA Workbooks.Open, resides inside the Workbook_Open subroutine. So, the problem remains unsolved. Thank you any way. Regards, Herminio. --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Use only the Auto_open macro - move the code from the workbook_open event to
the Auto_Open event. Then when it is opened remotely, the code doesn't run. (If I understand the situation correctly). -- Regards, Tom Ogilvy "Herminio " wrote in message ... Dears Tom and Chip. I've created a standard module with an Auto_Open subroutine, as you said, and, it's true, that code is *only* executed when you open the workbook manually (mouse click or Enter key). Nevertheless the Auto_Open code is executed *after* the Workbook_Open subroutine. That's too late, because the code I want to bypass, in case of a "remote" VBA Workbooks.Open, resides inside the Workbook_Open subroutine. So, the problem remains unsolved. Thank you any way. Regards, Herminio. --- Message posted from http://www.ExcelForum.com/ |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
That's it, Tom!
Congratulations! Thank you and have a nice day! Herminio -- Message posted from http://www.ExcelForum.com |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Thank you, Dave.
I need bypass only part of the Workbook_Open code, but it was nice to learn the new facility you've pointed out. Regards, Hermínio -- Message posted from http://www.ExcelForum.com |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
Herminio,
Take all the code out of the Workbook_Open event procedure and put it in the Auto_Open macro. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Herminio " wrote in message ... Dears Tom and Chip. I've created a standard module with an Auto_Open subroutine, as you said, and, it's true, that code is *only* executed when you open the workbook manually (mouse click or Enter key). Nevertheless the Auto_Open code is executed *after* the Workbook_Open subroutine. That's too late, because the code I want to bypass, in case of a "remote" VBA Workbooks.Open, resides inside the Workbook_Open subroutine. So, the problem remains unsolved. Thank you any way. Regards, Herminio. --- Message posted from http://www.ExcelForum.com/ |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open method used
I'll try.
I have to check if my Workbook_BeforeClose subroutine will not presen any new error in that case. Thank you. Regards, Herminio -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Workbook Open method | Excel Programming | |||
EXCEL.exe stays open after Quit method in an HTA | Excel Programming | |||
Open Method of workbooks class failed | Excel Programming | |||
Open Method disabling Macros | Excel Programming |