Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MG MG is offline
external usenet poster
 
Posts: 1
Default Run module ON OPEN event??

I'm trying to create a subroutine that runs as soon as anyone opens my network spreadsheet. I can get it to work if I run it as a macro, but I cannot get it to run ON OPEN. Here's my code:

Private Sub APP_Workbook_Open(ByVal WB As Workbook)
USER = Application.UserName
USER = UCase(USER)
Workbooks("xxxx.xls").HasRoutingSlip = True
With Workbooks("xxxx.xls").RoutingSlip
.Delivery = xlOneAfterAnother
.Recipients = "MG"
.Subject = "SPREADSHEET BEING ALTERED"
.Message = USER & "<-- " & "Has Altered The Attached Workbook"
End With
Workbooks("xxxx.xls").Route
End Sub

I've changed the name of the workbook to xxxx for this message.
Any help would be greatly appreciated.

Thanks,

Mike G.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Run module ON OPEN event??

Hi Mike,

Why not put the code into the "Workbooks" section and use the Workbook_Open event?

-------------------------------------------------

Private Sub Workbook_Open()

' Paste your code here, replacing "Workbooks("xxxx.xls")." with "ThisWorkbook"

End Sub

-------------------------------------------------

SuperJas.




----- MG wrote: -----

I'm trying to create a subroutine that runs as soon as anyone opens my network spreadsheet. I can get it to work if I run it as a macro, but I cannot get it to run ON OPEN. Here's my code:

Private Sub APP_Workbook_Open(ByVal WB As Workbook)
USER = Application.UserName
USER = UCase(USER)
Workbooks("xxxx.xls").HasRoutingSlip = True
With Workbooks("xxxx.xls").RoutingSlip
.Delivery = xlOneAfterAnother
.Recipients = "MG"
.Subject = "SPREADSHEET BEING ALTERED"
.Message = USER & "<-- " & "Has Altered The Attached Workbook"
End With
Workbooks("xxxx.xls").Route
End Sub

I've changed the name of the workbook to xxxx for this message.
Any help would be greatly appreciated.

Thanks,

Mike G.

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
When i open excel, i i get: Compile error in hidden Module, HELP! Snoopy Excel Discussion (Misc queries) 1 February 19th 09 03:07 PM
Open Event jlclyde Excel Discussion (Misc queries) 5 September 17th 08 09:18 PM
Event: open workbook Jeff Excel Discussion (Misc queries) 1 September 28th 06 02:58 PM
Where?Worksheet code module or Worksheet_SelectionChange event han Kenzie Excel Worksheet Functions 4 January 30th 06 09:41 PM
Open a XLS from a Module Giorgio[_2_] Excel Programming 3 December 17th 03 02:40 PM


All times are GMT +1. The time now is 09:32 AM.

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"