×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

calling a sub in personal.xlsb from with in a VBA module

calling a sub in personal.xlsb from with in a VBA module

calling a sub in personal.xlsb from with in a VBA module

(OP)
There must be an easier way to call subroutines in personal.lxsb from a VBA sub! I suspect I'm doing it wrong.
Calling a sub in my personal.lxsb is a pain. i.e wsOutLastRow = Application.Run("'" & "personal.xlsb" & "'!FindLast", "Row", "BP") it's the only way i know.

Is there some way to #include modules in external projects to simplify calling, i.e. wsOutLastRow = FindLast(“row”,”bp”)?

Please excuse if I’m not using the right terminology. I’ve been a programmer, off and on, for 40 years but, until now strictly top-down . This is my first foray into Object oriented programming and to much of it is still voodoo.

I'm trying to think but nothing happens. -- Curly

RE: calling a sub in personal.xlsb from with in a VBA module

I have never used personal.xlsb, but have for a long time used Add-Ins to achieve the capability you seem to be seeking.

RE: calling a sub in personal.xlsb from with in a VBA module

You need to let know the code in your workbook know that the code in other workbook exists. You have two options here:
- as Deniall wrote, create add-in, this makes its code public,
- give VBAProject in personal unique name and reference it in the workbook.

The third option is what you are doing now, force excel to execute procedure by passing its name.

combo

RE: calling a sub in personal.xlsb from with in a VBA module

To be slightly more explicit about combo's second option: Personal.xlsb should open whenever you open Excel (but will be hidden, if you created it correctly); rename the project from the default VBAProject to something hopefully unique, and you can then add it as a VBA reference (Tools>References). And can then use the public methods and public functions directly, just like an add-in.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close