Copying Sub Routines Between Excel Workbooks 
Author Message
 Copying Sub Routines Between Excel Workbooks

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



Sun, 06 May 2001 03:00:00 GMT  
 Copying Sub Routines Between Excel Workbooks
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.

Quote:

> 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




Sun, 06 May 2001 03:00:00 GMT  
 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




Tue, 08 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to create a copy of an Excel Workbook on Open

2. Copy an Excel sheet without opening the workbook.

3. Excel HRESULT: 0x800A03EC when using Workbooks.open or Workbooks._opentext in C#

4. Excel 97/2000: making custom functions (in a hidden workbook) available to all open workbooks

5. VBA: Excel workbook to workbook transfer

6. combine multiple excel workbooks into one workbook

7. Excel Workbook takes too long to open in Excel 2000

8. How can I open Excel workbook without using Excel.Worksheet

9. Error Handling Sub routines

10. Need Help! Converting Xbase sub-routine to VBA

11. Need help converting Xbase sub-routine to VBA

12. VBA sub routine parameters problem

 

 
Powered by phpBB® Forum Software