ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling a function from a Sub (https://www.excelbanter.com/excel-programming/412676-calling-function-sub.html)

DaveO[_2_]

Calling a function from a Sub
 
I have written code to open a series of files and change the various
aspects of the tabs in those files. I've started writing code in a
file called "Revisor" which opens the target files and makes changes.

Now I need to modify the code in the target files. I found Chip
Pearson's site and found a Sub to copy Sheet modules and the
ThisWorkbook module from one file to another, and successfully
modified it to fit my application: the modifiying code is in the
Revisor file, which opens a Master file to copy "from" and the Target
files to copy "to".

My hurdle at this moment is copying Module1. Mr. Pearson's site offers
a function to perform this, but I cannot get this to work for me after
several hours of working on it. I am not familiar enough with
functions to incorporate this into the code I've written, and I can't
quite follow the "Copy A Module From One Project To Another" logic at
CPearson.com- for instance, I don't see any assignment that
distinguishes one file as FromVBProject and another as ToVBProject.

Anyone used this, or have a moment to point me in the right direction?

Thanks

And as a final note, I am stupefied and amazed by the volume of
information at CPearson.com- my hat is off to you, sir!

DaveO[_2_]

Calling a function from a Sub
 
Pounded my head against it some more and figured this one out:
converted the function to a Sub and specified the Source and Target
file names. Thanks!


All times are GMT +1. The time now is 03:52 PM.

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