Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Add-In Calls Sub in Active Workbook

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Add-In Calls Sub in Active Workbook

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
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Add-In Calls Sub in Active Workbook

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
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
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
Problem in updating all worksheets of a workbook using a macro that calls another macro [email protected] Excel Programming 3 March 20th 06 05:21 AM
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Any automation calls gets hung when the Excel workbook has an active cell. S.Tremblay Excel Programming 1 November 6th 03 05:43 PM
Preventing opening workbook inside active workbook. Serge[_4_] Excel Programming 2 November 4th 03 07:51 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"