ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remote module call (https://www.excelbanter.com/excel-programming/374569-remote-module-call.html)

Patrick Simonds

Remote module call
 
I have 2 open workbooks Able and Baker

In WorkBook Able I call a Userform which has a ListBox. The ControlSource
for the ListBox is a range located on WorkBook Baker. The ListBox shows a
list of employees and their department. I want a sort button on my UserForm
which will run a sort routine on the workbook Baker which has the employee
data.

I have the Sort routines defined on WorkBook Baker :

Module1.SortByName
Module1.SortByDepartment

But how do I run the sort module on WorkBook Baker without leaving WorkBook
Able?



RaceEend

Remote module call
 
Patrick Simonds wrote:

I have 2 open workbooks Able and Baker

In WorkBook Able I call a Userform which has a ListBox. The
ControlSource for the ListBox is a range located on WorkBook Baker.
The ListBox shows a list of employees and their department. I want a
sort button on my UserForm which will run a sort routine on the
workbook Baker which has the employee data.

I have the Sort routines defined on WorkBook Baker :

Module1.SortByName
Module1.SortByDepartment

But how do I run the sort module on WorkBook Baker without leaving
WorkBook Able?


Application.Run "'Baker'!SortByName"
or if you have parameters
Application.Run "'Baker'!SortByName", Parameter1, Parameter2,..

Workbook Baker shouldbe open.


--


Tom Ogilvy

Remote module call
 
Application.Run "Baker.xls!SortByName"

--
Regards,
Tom Ogilvy

"Patrick Simonds" wrote in message
...
I have 2 open workbooks Able and Baker

In WorkBook Able I call a Userform which has a ListBox. The ControlSource
for the ListBox is a range located on WorkBook Baker. The ListBox shows
a
list of employees and their department. I want a sort button on my
UserForm
which will run a sort routine on the workbook Baker which has the employee
data.

I have the Sort routines defined on WorkBook Baker :

Module1.SortByName
Module1.SortByDepartment

But how do I run the sort module on WorkBook Baker without leaving
WorkBook
Able?






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com