Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Excel - Workbook call VBA code in external file?


  • Please log in to reply
1 reply to this topic

#1 GoshenBleeping

GoshenBleeping

  • Members
  • 254 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:11 PM

Posted 15 May 2014 - 03:20 PM

I have several Excel workbooks that all use the same VBA code. Rather than place the same code in each workbook file, I would like to place the VBA code in a single external text file and have each workbook reference and call the VBA code in that file. In this way, if the code needs to change, I can change the code in just one place rather than having to change the code in each Excel file. Note that I cannot combine the separate Excel workbooks into one workbook where each Excel file is a separate worksheet.) How can separate Excel workbooks call the VBA code in a single external file?



BC AdBot (Login to Remove)

 


#2 Budapest

Budapest

    Bleepin' Cynic


  • Moderator
  • 23,577 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:11 AM

Posted 15 May 2014 - 03:59 PM

I think you can do this with "Application.Run", but both workbooks need to be open.

http://www.rondebruin.nl/win/s9/win001.htm
The power of accurate observation is commonly called cynicism by those who haven't got it.

—George Bernard Shaw




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users