View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Application.Run error

You know the sheet codename/module name that should be called, right.

I used Sheet2 (just to be different).

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkbk As Workbook
Set wkbk = Workbooks("Code.xls")
Application.Run _
"'" & wkbk.Name & "'!sheet2.Worksheet_SelectionChange", Target
End Sub



wrote:

Hi,

I'm using the following code to do a call for a function in a workbook
called "Code"

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Run ("Code.xls!ModuleWorksheet_SelectionChange(Target) ")
End Sub

This code is in my primary project. However I receive an error that
say's the Macro cannot be found.
The "Code.xls" is in a workbook that holds of the codes I wish to use
in my project.(different workbook)
I've used various formats for the above code found on this forum.
Using Excel 2003 windows XP
Any help would be great.

Thanks


--

Dave Peterson