PC Review


Reply
Thread Tools Rate Thread

Add-In Calls Sub in Active Workbook

 
 
Paige
Guest
Posts: n/a
 
      15th Dec 2008
Can a sub in an add-in call a sub in another workbook? I need the add-in sub
to call a sub in the active workbook; the name of the active workbook
changes. Cannot figure out how to do this - keep getting error messages with
the application.run method. Any help would be appreciated.....thanks.
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      15th Dec 2008
You can use Application.Run to do this. Something like

Sub RunIt()
Dim WBName As String
WBName = ActiveWorkbook.Name
Application.Run "'" & WBName & "'!ProcedureName"
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Mon, 15 Dec 2008 08:59:01 -0800, Paige
<(E-Mail Removed)> wrote:

>Can a sub in an add-in call a sub in another workbook? I need the add-in sub
>to call a sub in the active workbook; the name of the active workbook
>changes. Cannot figure out how to do this - keep getting error messages with
>the application.run method. Any help would be appreciated.....thanks.

 
Reply With Quote
 
Paige
Guest
Posts: n/a
 
      15th Dec 2008
Thanks, Chip - works like a charm!

"Chip Pearson" wrote:

> You can use Application.Run to do this. Something like
>
> Sub RunIt()
> Dim WBName As String
> WBName = ActiveWorkbook.Name
> Application.Run "'" & WBName & "'!ProcedureName"
> End Sub
>
> Cordially,
> Chip Pearson
> Microsoft MVP
> Excel Product Group
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
>
> On Mon, 15 Dec 2008 08:59:01 -0800, Paige
> <(E-Mail Removed)> wrote:
>
> >Can a sub in an add-in call a sub in another workbook? I need the add-in sub
> >to call a sub in the active workbook; the name of the active workbook
> >changes. Cannot figure out how to do this - keep getting error messages with
> >the application.run method. Any help would be appreciated.....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
Re: Using wildcards in workbook calls meh2030@gmail.com Microsoft Excel Programming 0 28th Apr 2009 10:09 PM
Using wildcards in workbook calls Bishop Microsoft Excel Programming 0 28th Apr 2009 08:51 PM
Checking what calls a workbook A.for.Andy@gmail.com Microsoft Excel Discussion 0 7th Aug 2008 02:40 PM
Any automation calls gets hung when the Excel workbook has an active cell. S.Tremblay Microsoft Excel Programming 1 6th Nov 2003 05:43 PM
Any automation calls gets hung when the Excel workbook has an active cell. S.Tremblay Microsoft Excel Crashes 0 4th Nov 2003 10:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:31 PM.