Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Run VB sub from one workbook to another

I've got two workbooks, Model.xls and Shell.xls.

Model.xls contains a sub called "my_sub". It's defined as "Public Sub
my_sub()".

I need to open Model.xls using VBA code in Shell.xls and then run the sub
"my_sub". I know how to open one file from within another, but I don't know
how to call a sub. Any pointers on how to do this?

--
Hmm...they have the Internet on COMPUTERS now!
  #2   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Run VB sub from one workbook to another

Thanks - I knew it was something simple.
--
Hmm...they have the Internet on COMPUTERS now!


"Gary''s Student" wrote:

Consider:

Sub MDW()
ActiveWorkbook.FollowHyperlink Address:="file:///c:\model.xls"
Application.Run "Model.xls!my_sub"
End Sub

The FollowHyperlinks will open the file if not already open.
--
Gary''s Student
gsnu200712

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Run VB sub from one workbook to another

Consider:

Sub MDW()
ActiveWorkbook.FollowHyperlink Address:="file:///c:\model.xls"
Application.Run "Model.xls!my_sub"
End Sub

The FollowHyperlinks will open the file if not already open.
--
Gary''s Student
gsnu200712

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
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


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

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

About Us

"It's about Microsoft Excel"