×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-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!

*Eng-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

running macro in different workbook

running macro in different workbook

running macro in different workbook

(OP)
I need to run a macro that's in a closed workbook. The complete filespec is in cell W6 of the active sheet. The macro name is HIGHLITE. I'd like to do this without actually opening the workbook. Is this possible? If so some code would help a lot.

Thanks, LonnieP

RE: running macro in different workbook

I won't say it's impossible, because many unexpected things can be done by various devious tricks, but certainly the easiest way would be to open the file. That could be done in the background with VBA, and it could be automatically closed when you are finished, so the user wouldn't need to be aware of it at all.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: running macro in different workbook

(OP)
Doug, You're right. That's how I got the working range out of the source file to begin with, and ran the link-up macros while the file was minimized. Just hoping there was a simple way of doing it 'in the dark'. It all happens so fast it won't really make that much difference anyway.

Maybe someone out there can give a definite Yes or No on this.

LonnieP

RE: running macro in different workbook

(OP)
Walkenbach's book does indicate it can be done with something having to do with "References". I'm giving up on this, for now, because I've found a 'work around' that doesn't need Visual Basic, and should be more intuitive to the user.

LonnieP

RE: running macro in different workbook

I'm still a bit curious as to why you want to run a macro in a closed workbook.

The procedure for adding VBA references given by John Walkenbach (I'm looking at Excel 2002 Power Programming with VBA) is probably the easiest way to use a macro in a different workbook, but strictly speaking the referenced workbook is no longer closed once you have created the reference. The file doesn't need to be open to create the reference, but when it is created the file is automatically opened. If you link to a standard Excel file (.xls, xlsm, or xlsb) the file will be accessible after the reference is completed, just like any other open workbook. If you link to an add-in file (xla or xlam) the worksheets will be hidden, but the file will still be there in the background, and the VBA code will be accessible, unless it has been locked and protected.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: running macro in different workbook

(OP)
I'm porting over my Lotus calc system to Excel. Now that I'm retired I have the time to fool with it.

My system is based on small spreadsheets that can be stacked together, kind of like Legos. Sometimes I need to move, copy or delete a module but due to most of it being 'off screen', painting the range manually is too cumbersome. However, it's possiblle to make a VB macro that can paint the proper range. The down side is few of the blocks (modules) are the same size and the 100% solution would be to have the copy/move/delete macros in the module file itself, to be called when needed (hopefully without needing to actually open the file).

RE: running macro in different workbook

Sounds like setting up references might be the best approach. I had forgotten you could do that, so thanks for the reminder.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

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 Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

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

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


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

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

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close