View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Problems calling macros from "ThisWorkbook"

I had difficulty understanding the question.

But if the procedure is behind a worksheet, you could use:

Option Explicit
Public Sub mySub()
MsgBox "hi from the sheet"
End Sub

And call it via:
Option Explicit
Private Sub Workbook_Open()
Call Sheet1.mySub
End Sub

If the procedure is in ThisWorkbook:
Option Explicit
Public Sub mySub()
MsgBox "hi from thisworkbook"
End Sub

and called elsewhere (from a sheet or general module):
Option Explicit
Sub other_sub()
Call ThisWorkbook.mySub
End Sub

But I think moving general procedures to General modules is the best/safest bet.





blesbok wrote:

No one has any ideas?

--
blesbok
------------------------------------------------------------------------
blesbok's Profile: http://www.excelforum.com/member.php...o&userid=30635
View this thread: http://www.excelforum.com/showthread...hreadid=502891


--

Dave Peterson