PC Review


Reply
Thread Tools Rate Thread

Application.Run "[TemplateName].[ModuleName].[MacroName]

 
 
greg
Guest
Posts: n/a
 
      30th Jul 2008
Hello,
I am trying to call a sub in a module in an XLA from a regular excel
document.

I would like to pass along the
Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)

Action to the xla

So if my XLA is called Foo
And the module is called bar
How can I do this
I have tried the following

In the worksheet:

Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Application.Run "foo.bar.Workbook_SheetBeforeDoubleClick", Sh, Target,
Cancel
End Sub

which does not work

also tried just
Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Application.Run "Workbook_SheetBeforeDoubleClick", Sh, Target, Cancel
End Sub



In my XLA the sub in the module is:
Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
<<my code>>
End Sub



however I never see the call coming into the XLA


Any ideas?

thanks




 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      30th Jul 2008
You just need the name of the workbook (with extension) and the macro:

Application.Run "Book1.xls!RunMe"

--
Jim
"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| Hello,
| I am trying to call a sub in a module in an XLA from a regular excel
| document.
|
| I would like to pass along the
| Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target
| As Range, Cancel As Boolean)
|
| Action to the xla
|
| So if my XLA is called Foo
| And the module is called bar
| How can I do this
| I have tried the following
|
| In the worksheet:
|
| Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target
| As Range, Cancel As Boolean)
| Application.Run "foo.bar.Workbook_SheetBeforeDoubleClick", Sh, Target,
| Cancel
| End Sub
|
| which does not work
|
| also tried just
| Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target
| As Range, Cancel As Boolean)
| Application.Run "Workbook_SheetBeforeDoubleClick", Sh, Target, Cancel
| End Sub
|
|
|
| In my XLA the sub in the module is:
| Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target
| As Range, Cancel As Boolean)
| <<my code>>
| End Sub
|
|
|
| however I never see the call coming into the XLA
|
|
| Any ideas?
|
| thanks
|
|
|
|


 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      30th Jul 2008
So you mean
Application.Run "foo.xla.bar.Workbook_SheetBeforeDoubleClick", Sh, Target,


"Jim Rech" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> You just need the name of the workbook (with extension) and the macro:
>
> Application.Run "Book1.xls!RunMe"
>
> --
> Jim
> "greg" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> | Hello,
> | I am trying to call a sub in a module in an XLA from a regular excel
> | document.
> |
> | I would like to pass along the
> | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
> Target
> | As Range, Cancel As Boolean)
> |
> | Action to the xla
> |
> | So if my XLA is called Foo
> | And the module is called bar
> | How can I do this
> | I have tried the following
> |
> | In the worksheet:
> |
> | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
> Target
> | As Range, Cancel As Boolean)
> | Application.Run "foo.bar.Workbook_SheetBeforeDoubleClick", Sh,
> Target,
> | Cancel
> | End Sub
> |
> | which does not work
> |
> | also tried just
> | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
> Target
> | As Range, Cancel As Boolean)
> | Application.Run "Workbook_SheetBeforeDoubleClick", Sh, Target, Cancel
> | End Sub
> |
> |
> |
> | In my XLA the sub in the module is:
> | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
> Target
> | As Range, Cancel As Boolean)
> | <<my code>>
> | End Sub
> |
> |
> |
> | however I never see the call coming into the XLA
> |
> |
> | Any ideas?
> |
> | thanks
> |
> |
> |
> |
>
>



 
Reply With Quote
 
Jim Rech
Guest
Posts: n/a
 
      30th Jul 2008
This works for me:

Run "WorkbookWithExtension!ModuleName.SubName", Sh, Target, Cancel

--
Jim
"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| So you mean
| Application.Run "foo.xla.bar.Workbook_SheetBeforeDoubleClick", Sh, Target,
|
|
| "Jim Rech" <(E-Mail Removed)> wrote in message
| news:%(E-Mail Removed)...
| > You just need the name of the workbook (with extension) and the macro:
| >
| > Application.Run "Book1.xls!RunMe"
| >
| > --
| > Jim
| > "greg" <(E-Mail Removed)> wrote in message
| > news:(E-Mail Removed)...
| > | Hello,
| > | I am trying to call a sub in a module in an XLA from a regular excel
| > | document.
| > |
| > | I would like to pass along the
| > | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
| > Target
| > | As Range, Cancel As Boolean)
| > |
| > | Action to the xla
| > |
| > | So if my XLA is called Foo
| > | And the module is called bar
| > | How can I do this
| > | I have tried the following
| > |
| > | In the worksheet:
| > |
| > | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
| > Target
| > | As Range, Cancel As Boolean)
| > | Application.Run "foo.bar.Workbook_SheetBeforeDoubleClick", Sh,
| > Target,
| > | Cancel
| > | End Sub
| > |
| > | which does not work
| > |
| > | also tried just
| > | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
| > Target
| > | As Range, Cancel As Boolean)
| > | Application.Run "Workbook_SheetBeforeDoubleClick", Sh, Target,
Cancel
| > | End Sub
| > |
| > |
| > |
| > | In my XLA the sub in the module is:
| > | Public Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
| > Target
| > | As Range, Cancel As Boolean)
| > | <<my code>>
| > | End Sub
| > |
| > |
| > |
| > | however I never see the call coming into the XLA
| > |
| > |
| > | Any ideas?
| > |
| > | thanks
| > |
| > |
| > |
| > |
| >
| >
|
|


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
/x macroname John C. Microsoft Access Getting Started 2 24th Mar 2009 03:41 PM
Filename leads MacroName =?Utf-8?B?Q0xS?= Microsoft Excel Programming 4 29th Jan 2007 05:26 PM
Application.Run (WorkBook.Name & "!MacroName") Marve Microsoft Excel Programming 2 23rd Oct 2006 03:21 PM
Application.Run("MacroName", Args) Abraham Andres Luna Microsoft Excel Programming 2 23rd Jan 2006 07:05 PM
Application popup: Explorer.EXE - Application Error : The instruction at "0x77f57ec4" referenced memory at "0x00000067". The memory could not be "written". Max Windows XP General 3 18th Dec 2003 05:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:09 PM.