Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Procedure not working AD108 Excel Programming 4 April 13th 06 08:06 PM
user form-on open event? keydown event? FSt1[_3_] Excel Programming 2 August 5th 04 02:26 PM
before print event not working goss[_17_] Excel Programming 2 January 29th 04 03:54 AM
Workbook_Open event not working jason Excel Programming 2 September 7th 03 04:02 PM


All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"