Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Workbook_Open Event not firing

I'm trying to write code that will disable the "Sort" menu option when I open
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.

Just to test, here is the code I put in:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Call disable_sort(True)
MsgBox "Workbook_BeforeClose"

End Sub

Private Sub Workbook_Open()

MsgBox "Workbook_Open"

End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

'Call disable_sort(False)

MsgBox "Workbook_SheetActivate"

End Sub

When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.

So what's the deal with Workbook_Open? </Seinfeld
--
Hmm...they have the Internet on COMPUTERS now!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Workbook_Open Event not firing

Hi,
I do not see any call to disable_sort in Workbook_Open? If the call to
disable_sort with the True parameter is supposed to turn off the Sort option
then your Workbook_Open event should include that

Private Sub Workbook_Open()

Disable_Sort True
MsgBox "Workbook_Open"

End Sub


"MDW" wrote:

I'm trying to write code that will disable the "Sort" menu option when I open
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.

Just to test, here is the code I put in:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Call disable_sort(True)
MsgBox "Workbook_BeforeClose"

End Sub

Private Sub Workbook_Open()

MsgBox "Workbook_Open"

End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

'Call disable_sort(False)

MsgBox "Workbook_SheetActivate"

End Sub

When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.

So what's the deal with Workbook_Open? </Seinfeld
--
Hmm...they have the Internet on COMPUTERS now!

  #3   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Workbook_Open Event not firing

I already tried that. It doesn't work.

Like I said, I can't even get the messagebox to appear. The event itself
isn't firing.

--
Hmm...they have the Internet on COMPUTERS now!


"Alok" wrote:

Hi,
I do not see any call to disable_sort in Workbook_Open? If the call to
disable_sort with the True parameter is supposed to turn off the Sort option
then your Workbook_Open event should include that

Private Sub Workbook_Open()

Disable_Sort True
MsgBox "Workbook_Open"

End Sub


"MDW" wrote:

I'm trying to write code that will disable the "Sort" menu option when I open
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.

Just to test, here is the code I put in:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Call disable_sort(True)
MsgBox "Workbook_BeforeClose"

End Sub

Private Sub Workbook_Open()

MsgBox "Workbook_Open"

End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

'Call disable_sort(False)

MsgBox "Workbook_SheetActivate"

End Sub

When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.

So what's the deal with Workbook_Open? </Seinfeld
--
Hmm...they have the Internet on COMPUTERS now!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Workbook_Open Event not firing

Sometimes the code turns off the events by executing this line

Application.EnableEvents = False

This may have happened in your case. Either this excel workbook or another
one loaded in the same Excel instance may have done it.

I suggest you close your workbook and then open it again in a new instance
of excel. That is Start Excel and then do File/Open.



"MDW" wrote:

I already tried that. It doesn't work.

Like I said, I can't even get the messagebox to appear. The event itself
isn't firing.

--
Hmm...they have the Internet on COMPUTERS now!


"Alok" wrote:

Hi,
I do not see any call to disable_sort in Workbook_Open? If the call to
disable_sort with the True parameter is supposed to turn off the Sort option
then your Workbook_Open event should include that

Private Sub Workbook_Open()

Disable_Sort True
MsgBox "Workbook_Open"

End Sub


"MDW" wrote:

I'm trying to write code that will disable the "Sort" menu option when I open
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.

Just to test, here is the code I put in:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Call disable_sort(True)
MsgBox "Workbook_BeforeClose"

End Sub

Private Sub Workbook_Open()

MsgBox "Workbook_Open"

End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

'Call disable_sort(False)

MsgBox "Workbook_SheetActivate"

End Sub

When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.

So what's the deal with Workbook_Open? </Seinfeld
--
Hmm...they have the Internet on COMPUTERS now!

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
Workbook_Open event not firing for Excel2K John Keith[_2_] Excel Programming 4 February 15th 06 02:44 PM
Event macro firing twice Otto Moehrbach Excel Programming 10 July 6th 05 11:57 PM
Workbook_Open event not firing 0013 Excel Programming 4 May 24th 05 09:53 PM
Event sometimes stops firing? HotRod Excel Programming 7 May 5th 05 12:20 AM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 06:49 PM.

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

About Us

"It's about Microsoft Excel"