How to Call a function in another workbook?

  • Thread starter Thread starter Adrian
  • Start date Start date
A

Adrian

I have a system of several workbooks, each with their own
worksheets and projects.
How do I call a function from one VBA project that exists
in another workbook's project?

eg. in the Workbook named Data.xls there is a VBA project
which includes a function named Tinfo().
In the Workbook named Registrations.xls I'm writing
further VBA procedures and functions, and I want to use
the function Tinfo().
In a worksheet cell I would write =data.xls!tinfo()
What do I write in VBA?
 
I get an error message

The macro 'data.xls!Tinfo("shortname",tut,"initials")'
cannot be found.

The workbook is open, and the function is there. The value
of the variable tut is sensible.
Help!
 
application.Run "data.xls!Tinfo", "shortname", tut, "initials"

if you want to return a value

returnValue = application.Run( "data.xls!Tinfo", "shortname", tut,
"initials")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top