![]() |
Open Event not working
I have a workbook template that is opened "externally" via code---a
VB-like form opens the workbook and creates a new worksheet. I don't have access to this code, but I do need to add code to the template that is triggered either upon open or creating the new sheet. However, neither of these events will trigger since the book is being opened via external code. Is there anyway to work around this? I cannot modify the VB-like form or the module that is initially opening the book and creating the new worksheet. TIA... |
Open Event not working
You could add you code to an Auto_Open sub in a standard code module.
-- HTH Bob Phillips (remove nothere from the email address if mailing direct) wrote in message oups.com... I have a workbook template that is opened "externally" via code---a VB-like form opens the workbook and creates a new worksheet. I don't have access to this code, but I do need to add code to the template that is triggered either upon open or creating the new sheet. However, neither of these events will trigger since the book is being opened via external code. Is there anyway to work around this? I cannot modify the VB-like form or the module that is initially opening the book and creating the new worksheet. TIA... |
Open Event not working
Bob, I've tried adding an auto_open() sub to the workbook_open event,
but it just gets bypassed. If I open the template by double clicking the file, the open event is triggered, but when it's opened through the vb-like form, the open event code is bypassed. I tried the code below, but I can't get it triggered after "opening" the form via form: Sub workbook_open () auto_open() End sub Sub auto_open() '*** hide the scollbars With ActiveWindow .DisplayVerticalScrollBar = False .DisplayHorizontalScrollBar = False End With End sub |
Open Event not working
What if the code is added to the Workbook_Open event in ThisWorkbook module ?
Auto_Open code has to be called specifically if workbook is opened programmically e.g. Set wb = Workbooks.Open "myBook.xls" wb.RunAutoMacros xlAutoOpen Kevin Beckham " wrote: Bob, I've tried adding an auto_open() sub to the workbook_open event, but it just gets bypassed. If I open the template by double clicking the file, the open event is triggered, but when it's opened through the vb-like form, the open event code is bypassed. I tried the code below, but I can't get it triggered after "opening" the form via form: Sub workbook_open () auto_open() End sub Sub auto_open() '*** hide the scollbars With ActiveWindow .DisplayVerticalScrollBar = False .DisplayHorizontalScrollBar = False End With End sub |
Open Event not working
Kevin, I guess I'm a bit confused. Here's what I've got thus far:
ThisWorkbook: Private Sub Workbook_Open() ActiveWorkbook.RunAutoMacros xlAutoOpen End Sub Module1: Sub auto_open() MsgBox "event happened" End Sub This does not work when the workbook is opened via the VB-like form, but it does work when you dbl click the template to open. It seems the workbook_open event is being bypassed. |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com