
Copying Sub Routines Between Excel Workbooks
Yes...I copied the entire module sheet. Each time I called the macro it would
break on the first Dim statement. The good news is...I found a workaround.
To call a subroutine that is defined in a different workbook, create a
reference to that workbook. No need to define variables in the calling
workbook. As long as they are defined in the source workbook, the macro will
execute. I tried it with success.
Thanks!
Soraya Anderson
Quote:
> Well, did you make sure to copy the data type definition that's missing?
> Try copying the entire module instead of just the macro. Post the code.
> Boden Larson
> SGM Biotech, Inc.
> > Hello,
> > Is it possible to copy & paste sub-routines for use in other Excel
> > workbooks? Macro 1 (to retrieve data from an external Access db) runs
> > successfully in Workbook A. However when I copy, paste & edit the macro
> > to Workbook B and run it, I get a "user-defined data type not defined"
> > error message. Does anyone know why this happens and how I can fix it?
> > I was careful to rename the macro and change any reference to Workbook
> > A.
> > Any info would be helpful.
> > Pls email.
> > Regards,
> > Soraya Anderson